【发布时间】:2020-06-01 07:26:56
【问题描述】:
假设在我的代码中,我有以下两个图表:即 graph_p_changes 和 graph_p_contrib
line_grapgh_p_changes = df_p_change[['year','interest accrued', 'trade debts', 'other financial assets']].melt('year', var_name='variables', value_name='p_changes')
graph_p_changes = sns.factorplot(x="year", y="p_changes", hue='variables', data=line_grapgh_p_changes, height=5, aspect=2)
graph_p_changes.set(xlabel='year', ylabel='percentage change in self value across the years')
line_grapgh_p_contrib = df_p_contrib[['year','interest accrued', 'trade debts', 'other financial assets']].melt('year', var_name='variables', value_name='p_changes')
graph_p_contrib = sns.factorplot(x="year", y="p_changes", hue='variables', data=line_grapgh_p_contrib, height=5, aspect=2)
graph_p_contrib.set(xlabel='year', ylabel='percentage chnage in contribution to total value')
现在在我的代码稍后的某个时间点,我只想显示上述两个图表之一。但是当我执行 plt.show() 时,它会在我的 jupyter 笔记本中显示上述两个图表。如何在我的代码中的任何时候只显示一个图表。
【问题讨论】:
标签: python-3.x matplotlib plot data-visualization seaborn