I have data in a pandas dataframe that I need to plot as a scatter plot, but I need to both colormap the points to a third column (day) and vary the marker style based on a fourth column (set). My data is of the form:
import pandas as pd
results = pd.DataFrame([[85,72,1,630], [67,50,1,700], [90,43,2,630], [79,53,2,700]],
columns = ['x', 'y', 'day', 'set'])
but I have many more values for 'day'
and 'set'
in the actual dataframe.
I tried copying the example given in the pandas.Dataframe.plot.scatter documentation to achieve the colormap, but I got the ValueError:
'c' argument must be a color, a sequence of colors, or a sequence of numbers, not ['1', '1', '2', '2'].
I think I should be able to write a dictionary that indicates a marker style for each set value, but I don't know how to call this in df.plot.scatter()
.