0

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()
Ger
  • 1
  • I think your example is from https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.scatter.html, your image looks exactly the same with the document. What actually do you want? – Ynjxsjmh Jul 23 '20 at 05:40
  • The image is fine if I run a .py file, but in Jupyter not. There seems to be a problem with the colormap and jupyter. Is not the same image X axis text not displayed in Jupyter. – Ger Jul 28 '20 at 16:42

1 Answers1

0

I think plt.legend () is missing and also any label value is not specified....I hope this hint might help you.

Jam pavy
  • 11
  • 4
  • The code work fine if I run a .py file, but not en Jupyter. This is a problem whth colomap and Jupyter. Also, plt.legend() not work – Ger Jul 28 '20 at 16:37
  • Hey these answers can help you https://stackoverflow.com/questions/17411940/matplotlib-scatter-plot-legend – Jam pavy Jul 29 '20 at 17:28