带有辅助轴的熊猫图功能-控制图例位置

时间:2020-06-30 19:03:53

标签: python pandas plot

我正在将数据框中的两列绘制到具有两个y轴的1个图中。我在plot函数中使用了内置的“ secondary_y”选项,但似乎在需要的地方绘制了图例,我无法控制它。参见下文,这是一个问题,因为您无法看到图例上的内容。 gh。

代码:

experiments_summary = pd.concat([all_results_porto.groupby(group_by_var)['CPU Time'].mean(),all_results_porto.groupby(group_by_var)['Average Journey Time'].mean()], axis = 1)

fig, ax = plt.subplots(figsize=(8,3))
experiments_summary.plot(kind='bar', secondary_y= 'Average Journey Time',rot = 45 ,ax = ax,grid = True)

plt.tight_layout()
plt.show()

这是情节:

enter image description here

更新:有关解决方案,请参见以下帖子

stackoverflow.com/a/56877283/6361531

0 个答案:

没有答案