Styling your plots

The style package within the matplotlib library makes it easier to change the style of the plots that are being plotted. It is very easy to change to the famous ggplot style of the R language or use the Nate Silver's website for fivethirtyeight style. The following example shows the plotting of a simple line chart with the ggplot style:

>>> plt.plot([1, 2, 3, 4], [1, 4, 9, 16])

After the preceding code is executed we'll get the following output:

Styling your plots

In the preceding code, is used to set the style of the plot. It is a global set, so after it is executed, ...

Get Mastering Python for Data Science now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.