Sitemap

Python Matplotlib Style

2 min readAug 23, 2017

Matplotlib is a great and very capable plotting library for Python. Matplotlib 2.0 made a few changes to their default style that improved the look and feel the graphs. However, we can do more by defining our own settings. This is the setup that I usually use for my plots.

plt.style.use('seaborn-poster')
plt.style.use('fivethirtyeight')
plt.rcParams['axes.edgecolor'] = '#ffffff'
plt.rcParams['axes.facecolor'] = '#ffffff'
plt.rcParams['figure.facecolor'] = '#ffffff'
plt.rcParams['patch.edgecolor'] = '#ffffff'
plt.rcParams['patch.facecolor'] = '#ffffff'
plt.rcParams['savefig.edgecolor'] = '#ffffff'
plt.rcParams['savefig.facecolor'] = '#ffffff'
plt.rcParams['xtick.labelsize'] = 16
plt.rcParams['ytick.labelsize'] = 16

The following are three example from Matplotlib tutorial with our custom style.

To see list of available styles just use:

import matplotlib.pyplot as plt
print plt.style.available

To read more about other settings have a look at the documentation.

--

--

Amirali Sanatinia
Amirali Sanatinia

Written by Amirali Sanatinia

Security, Cryptography, Privacy, AI

No responses yet