I have 2D data with string labels in a dataframe:
df = pd.DataFrame(data, columns = ['dim1', 'dim2', 'label'])
The labels are strings that have an ordering e.g 'small', 'small-medium, 'medium', 'medium-big', 'big' (simplified for the purposes of the question).
I would like to plot my data on a scatterplot in such a way so that the colors reflect the ordering (so I'm going to use to a perceptually uniform sequential colormap).
Currently, here's what I have, which just plots the datapoints and colors them based on their labels:
groups = df.groupby('label')
fig = plt.figure(figsize=[20, 20])
ax = fig.add_subplot(111)
for name, group in groups:
ax.plot(group.dim1, group.dim2, label=name, marker='o', linestyle='', markersize=12)
ax.legend(fontsize=20)
How can I adjust the code so that it does what I want?