Fix Python – plot different color for different categorical levels using matplotlib

I have this data frame diamonds which is composed of variables like (carat, price, color), and I want to draw a scatter plot of price to carat for each color, which means different color has different color in the plot.
This is easy in R with ggplot:
ggplot(aes(x=carat, y=price, color=color), #by setting color=color, ggplot automatically draw in ….

Fix Python – Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python

I’m learning to use matplotlib by studying examples, and a lot of examples seem to include a line like the following before creating a single plot…
fig, ax = plt.subplots()

Here are some examples…

Modify tick label text
http://matplotlib.org/examples/pylab_examples/boxplot_demo2.html

I see this function used a lot, even though the example i….