簡體   English   中英

帶有彩條的數據框 plot 在 Jupyter Notebook 中不顯示 x 圖例

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

如果我在 JUPYTER 中運行此代碼在 Jupyter Notebook 中,則不會顯示 x lengend。 圖片a.py 源代碼中的相同代碼可以正常工作。 如果我刪除彩條也可以正常工作。 代碼:

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()

我認為 plt.legend () 丟失了,並且沒有指定任何 label 值....我希望這個提示可以幫助你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM