简体   繁体   中英

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. image The same code in a.py source works fine. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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