Home > Software design >  Adding a Legend to Pandas Scatterplot
Adding a Legend to Pandas Scatterplot

Time:12-31

I am using the Pandas version of Scatter, not Matplotlib. How would I add a legend to this graph based on the colors?

enter image description here

CodePudding user response:

I found a solution: under the dat.plot.scatter(), add legend=True like this:

dat.plot.scatter(x='SqFt', y='Price', c=colorZip, figsize = (15, 8), s = 100, legend = True)

CodePudding user response:

This is all you need:

dat.legend()
  • Related