Attempting to create a seaborn scatterplot matrix using multiple datasets

I have a data-frame with soil temperature data from several different models that I want to create a scatterplot matrix of. The data frame looks like this dataframe structure

The data is organized by model (or station), and I have also included a couple of columns to differentiate between data occurring between the cold or warm season, as well as the layer that the data is from.

My goal is to create a scatterplot matrix with the following characteristics:

  1. data color-coded by season (which I have set up in the script so far)
  2. the bottom triangle only consisting of data from the 0cm to 30cm soil layer, and the upper triangle only consisting of data from the 30cm to 300cm soil layer.

I have figured out how to create a scatterplot matrix for one triangle/portion of the dataset at a time, such as in this example Scatterplot for top 30cm

however I am unsure of how to have a different portion of the data to be used in each triangle.

The relevant files can be found here:

  1. bottom dataframe
  2. top dataframe
  3. master dataframe

Here is the relevant code

dframe_scatter_top = pd_read.csv(dframe_top.csv)
dframe_scatter_btm = pd_read.csv(dframe_btm.csv)
dframe_master = pd.read_csv(dframe_master.csv)
scatter1 = sn.pairplot(dframe_scatter_top,hue='Season',corner='True')
sns.set_context(rc={"axes.labelsize":20}, font_scale=1.0)
sns.set_context(rc={"legend.fontsize":18}, font_scale=1.0)
scatter1.set(xlim=(-40,40),ylim=(-40,40))
plt.show()

I suspect that the trick is to use Pair Grid, and set one portion of the data to appear in map upper and the other portion in map lower, however I don't currently see a way to explicitly split the data. For example is there a way perhaps to do the following?

scatter1 = sns.PairGrid(dframe_master)
scatter1.map_upper(#only plot data from 0-30cm)
scatter1.map_lower(#only plot data from 30-300cm)


Read more here: https://stackoverflow.com/questions/68124000/attempting-to-create-a-seaborn-scatterplot-matrix-using-multiple-datasets

Content Attribution

This content was originally published by arctic_climate_science at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: