I am not sure how to do this but I believe is doable. I have three dataframes having the same column definition but dataset from different years. I then want to pairplot the numeric columns taking the columns one-by-one and plotting the data from these dfs appropriately labeling the set for which data comes from. The objective is to understand the pattern in data for each column as compared by year.
I illustrate what I mean with these 2 dataframes where dataset in df1 is from year 2018 and df2 from year 2019 respectively:
df1
id speed accelaration jerk mode
0 1 1.94 -1.01 1.05 foot
1 1 0.93 0.04 -0.17 foot
2 3 0.50 -0.16 0.05 bike
3 3 0.57 0.05 0.19 bike
4 5 3.25 -0.13 -0.09 bus
5 5 0.50 -0.25 0.25 bus
6 5 0.25 0.10 0.25 bus
df2
id speed accelaration jerk mode
0 17 1.5 0.00 0.00 foot
1 17 1.5 0.00 -0.30 foot
2 17 1.5 -0.30 0.06 foot
3 15 4.55 0.01 -0.36 bike
4 15 4.57 -0.35 0.02 bike
5 87 9.82 -0.29 -0.12 bus
6 87 8.65 -0.78 0.07 bus
Ignoring the id column, I would like to get a result that looks like this figure (this is just an illustration of the intended result that I draw):
Simply calling sns.pairplot() twice for each df will not give the intended result, as I did that:
sns.pairplot(df1, vars=df1.columns[1:4], hue='mode')
sns.pairplot(df2, vars=df2.columns[1:4], hue='mode')
plt.show()
Can someone help describe how the intended answer could be obtained from this?


