References and further information

A good reference for all the rc-options is here:

High-Quality Plots

LaTeX rendering

Using LaTeX in matplotlib:

The LaTeX temporary files are stored at ~/.matplotlib/tex.cache.


LaTeX rendering can be activated using

import matplotlib
# Before pylab!
from matplotlib import rc
rc(‘text’, usetex=True)

it does not seem to work with the GTK backend, I obtain an error.

Change the power limit for scientific notation

#axes.formatter.limits : -7, 7 # use scientific notation if log10
                               # of the axis range is smaller than the
                               # first or larger than the second
rcParams['axes.formatter.limits'] = (-1,1)

This also affects the labels on the colorbar.

Manual Hacks:

This can be done using the parameter text.latex.preamble

Publication quality settings

Example settings used for plots

Changing the layout for certain journals:

Size of Colorbar

The height, width, etc. of the colorbar can be adjusted using the keywords

shrink, fraction, aspect, pad, orientation


Specific Labels (pi,…) (2011-06-26) axes.set_xticks([float((j-1/3)*np.pi) for j in range(0,3)]) axes.set_xticklabels(['$-\pi/3$', '$2\pi/3$', '$5\pi/3$'])

Thickness of line around plot

rcParams[‘axes.linewidth’] = 0.7

Minor Ticks in Log Plot

Padding between the axes and the labels (2011-06-27)

ax.xaxis.labelpad = 20

Tick label orientation an vertical position (2011-07-12)

This can be done using

for label in ax.get_xticklabels():

Bold Ticks

Multiple Axes

Backend selection

Logarithmic axes

Saving Figures to pdfs

Subplot adjustment and size

atplotlib.pyplot.subplots_adjust see

Matplotlib AxesGrid Toolkit

Contour Plots

Logarithmic color bar:,




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: