One way is to stack your data frames and use the row=
argument inside catplot
. First to create something like your data:
import pandas as pd
import numpy as np
import seaborn as sns
df1 = pd.DataFrame({'Cat':np.random.choice(['C1','C2','C3'],50),
'Data':np.random.uniform(0,1,50),"Period":np.random.choice(['AA','CC','DD'],50)})
df2 = pd.DataFrame({'Cat':np.random.choice(['C1','C2','C3'],50),
'Data':np.random.uniform(0,1,50),"Period":np.random.choice(['AA','CC','DD'],50)})
df3 = pd.DataFrame({'Cat':np.random.choice(['C1','C2','C3'],50),
'Data':np.random.uniform(0,1,50),"Period":np.random.choice(['AA','CC','DD'],50)})
Then concat the dataframes and add another column (i used source below) to annotate the dataframe:
allCN=pd.concat([df1,df2,df3])
allCN['source'] = np.repeat(['df1','df2','df3'],[len(df1),len(df2),len(df3)])
sns.catplot(x="Cat", y="Data",
col="Period", row = "source",
data=allCN, kind="box", height=2,aspect=1.6)