How to customize Matplotlib using matplotlibrc

If you find yourself using Matplotlib a lot, then it might be worth your while to customize its default configuration. This is best done using a matplotlibrc file.

  • You can find the global configuration file at /etc/matplotlibrc.

  • If you installed Matplotlib using pip, there is another global configuration file inside your Python installation that overrides the one in /etc. On my system, this path was /usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/matplotlibrc.

  • The best way to keep your Matplotlib customizations is to maintain it in your home directory at: ~/.config/matplotlib/matplotlibrc. You can have a look at the default configurations in the global files (above) and only set those you want to change in your home file.

Matplotlib will pick up these settings whenever it is executed.

Tried with: Matplotlib 1.4.3, Python 2.7.6 and Ubuntu 14.04

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s