【发布时间】:2021-01-14 11:10:33
【问题描述】:
我有一个 pandas DataFrame 如下:
df=pd.DataFrame({'depth':[499,500,501,502,503],'parameter1':[25,29,24,23,25],'parameter2':[72,80,65,64,77]})
我希望在同一个图表下绘制多个(在本例中为两个)seaborn lineplots,作为子图。 我想在 x-axis 上保持 depth 参数不变,但根据 y-axis 参数改变其他列值。
sns.relplot(x='depth',y="parameter1",kind='line',data=df)
sns.relplot(x='depth',y="parameter2",kind='line',data=df)
我曾尝试使用seaborn.FacetGrid(),但我没有得到正确的结果。
让我知道如何将这些图绘制为单个图下的子图,而无需单独定义它们。
【问题讨论】:
-
sns.relplot是FacetGrid。
标签: python pandas dataframe seaborn