Solved – Visualising 2 Independent Variables and 1 Dependent Variable

data visualizationpython

I'm trying to come up with the best way to graphically display misfits from multiple geophysical inversion runs, where I am fixing two independent variables and analysing the misfit of each test. For example, the test structure may look like

        Var1  Var2  Misfit (%)
Test 1    8    1.5   13.5
          8    2.0   12.4
          8    2.5   10.1

        Var1  Var2  Misfit (%)
Test 2    10   1.5   20.4
          10   2.0   23.1
          10   2.5   15.0
        Var1  Var2  Misfit (%)
Test 3    12   1.5    5.5
          12   2.0    8.9
          12   2.5   17.5

What would be the best way to graphically display these tests? The objective is to better understand trends in misfit given the two independent variables, Var1 and Var2.
I'm thinking I could set different colours for Var1, set the x-axis to Var2, and then set the y-axis to Misfit.
If anyone has any experience with this sort of testing and visualization, any recommendations is appreciated! I will most likely be working with Python or Python Pandas.

Best Answer

Since your DV is Misfit, using Var1 and Var2 as your x-y axes, and coloring Misfit, i.e. your z and with a suitable colormap would be the best to obtain an intuition how your DVs combined effect look like.

Specific to Python, you can use matplotlib scatter plots with c argument as your color variable. For example, in your case, assume we have a dataframe with columns Var1,Var2 and MisFit:

`plt.scatter(df.Var1,df.Var2,c=df.MisFit)`
Related Question