You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
API: support c and colormap args for DataFrame.plot with kind='scatter'
`matplotlib.pyplot.scatter` supports the argument `c` for setting the color of
each point. This patch lets you easily set it by giving a column name (currently
you need to supply an ndarray to make it work, since pandas doesn't use it):
df.plot('x', 'y', c='z', kind='scatter')
vs
df.plot('x', 'y', c=df['z'].values, kind='scatter')
While I was at it, I noticed that `kind='scatter'` did not support the `colormap`
argument that some of the other methods support (notably `kind='hexbin'`). So
I added it, too.
This change should be almost entirely backwards compatible, unless folks are naming
columns in their data frame valid matplotlib colors and using the same color name
for the `c` argument.
A colorbar will also be added automatically if relevant.
0 commit comments