Altair way
alt.Chart(cars).mark_point().encode(
x='Acceleration:Q',
y='Miles_per_Gallon:Q',
color='Origin:N'
)
Matplotlib Way
for car in cars['Origin'].unique():
d_ = cars[cars['Origin'] == car]
plt.scatter(data=d_, x='Acceleration', y='Miles_per_Gallon')
Is it the above correct for MPL or is there a better way?
patches = [mpatches.Patch(color=c, label=l) for c, l in zip(colors, labels)]
ax3.legend(patches, labels, ncol=1, loc=6)
Some excerpts from the notes that I make