Search code examples
matplotlibstylesthemesanaconda

Anaconda matplotlib theme / styling / colorcyle


Does anyone know what a default Anaconda install does to change Matplotlib styling?

For example:

import matplotlib.pyplot as pl
pl.figure()
pl.xlabel('X label')
pl.ylabel('Y label')
pl.plot([1,2,3], [4,5,6])
pl.plot([1,2,3], [6,5,4])
pl.show()

The above code creates a blue and a green line on default matplotlib, but blue and orange when run in Anaconda. The axis labels have also changed from a serif (default) to a sans-serif font (Anaconda).

Is this a matplotlib theme? Custom or available from (free) sources? Is it anaconda itself or some package included in it?

Any hints/answers are much appreciated

-- Update --

I found two matplotlibrc files in the anaconda directory, both simply set a backend and had all other lines commented out.


Solution

  • This has nothing to do with anaconda. You most likely have two different versions of matplotlib installed and the one that anaconda uses is the newer one of them.

    The default style of matplotlib changed between versions 1.5 and 2.0. See Changes to the default style.

    To revert to the classic style (the one used in version 1.5), you may use

    plt.style.use("classic")
    

    For an overview of all available styles, see the style_sheets_reference for 2.0.0.

    You may create your own stylesheets as detailed in the Customizing article.