I am using the Pandas version of Scatter, not Matplotlib. How would I add a legend to this graph based on the colors?
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()