fig, ax = plt.subplots() colors=['#1f77b4', '#ff7f0e', '#2ca02c'] for color, species in zip(colors, df.species.unique()): tmp = df[df.species == species] ax.scatter(tmp.petalLength, tmp.petalWidth, label=species, color=color) ax.set(xlabel='Petal Length', ylabel='Petal Width') ax.legend(loc=2);
Hosted onDeepnote