How to change DPI in Matplotlib

Updated post here: https://codeyarns.github.io/tech/2015-07-29-how-to-change-dpi-in-matplotlib.html

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