如何在seaborn中获得2个独立的地块?

时间:2015-03-30 00:50:00

标签: python python-2.7 pandas seaborn

我有一个很大的功能,输出是一个数据帧和2个图表。像这样:

summary = pd.concat([mean, std], axis=1)
chart1 = sns.tsplot(sample['x'].cumsum())
chart2 = sns.tsplot(summary['mean'])
result = [summary, chart1, chart2]
return result

一切都很好,除了,我只得到一个包含两个时间序列的图表。我想得到两个单独的图表。我该怎么做?

由于

1 个答案:

答案 0 :(得分:4)

将显式matplotlib对象提供给tsplot

import matplotlib.pyplot as plt
import seaborn as sns

summary = pd.concat([mean, std], axis=1)
chart1, ax1 = plt.subplots()
sns.tsplot(sample['x'].cumsum(), ax=ax1)

chart2, ax2 = plt.subplots()
sns.tsplot(summary['mean'], ax=ax2)
result = [summary, chart1, chart2]
return result