【发布时间】:2018-01-28 08:13:45
【问题描述】:
我正在使用 ipython 笔记本(python 2)并在同一个图上绘制条形图和线图。有两个系列(NPS 和计数评级)。但是,当我尝试显示图例时,它只显示第二个系列的图例。
下面是我的代码:
ax=nps_funding_month[35:][nps_funding_month['count_ratings']>=100].set_index('funding_month')['nps_percentage'].\
plot(kind='line',color='green',label='NPS')
plt.ylabel('Net Promoter Score')
ax=nps_funding_month[35:][nps_funding_month['count_ratings']>=100].set_index('funding_month')['count_ratings'].\
plot(kind='bar',secondary_y=True,label='Count of Ratings')
plt.ylabel('Count Ratings')
plt.legend()
plt.title('Net Promoter Score by Funding Month\n(Only Funding Months with at Least 100 Reviews)')
【问题讨论】:
标签: python pandas matplotlib plot