简体   繁体   English

带有彩条的数据框 plot 在 Jupyter Notebook 中不显示 x 图例

[英]Data frame plot with color bar not show x legend in Jupyter Notebook

If i run in JUPYTER this code in Jupyter Notebook the x lengend is not showed.如果我在 JUPYTER 中运行此代码在 Jupyter Notebook 中,则不会显示 x lengend。 image The same code in a.py source works fine.图片a.py 源代码中的相同代码可以正常工作。 If I remove colorbar work fine too.如果我删除彩条也可以正常工作。 Code:代码:

df = pd.DataFrame([[5.1, 3.5, 0], [4.9, 3.0, 0], [7.0, 3.2, 1],
                [6.4, 3.2, 1], [5.9, 3.0, 2]],
             columns=['length', 'width', 'species'])
ax2 = df.plot.scatter(x='length',y='width',c='species',
                colormap='viridis')
plt.show()

I think plt.legend () is missing and also any label value is not specified....I hope this hint might help you.我认为 plt.legend () 丢失了,并且没有指定任何 label 值....我希望这个提示可以帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM