Sane color scheme for Matplotlib

6 comments    Posted on February 8th, 2011

What Python’s MatPlotlib allows for in flexibility, it majorly lacks in aesthetics. Compared to graphs produced using ggplot2, the graphs I make using matplotlib strain my eyes. For the most part, this is caused by its default color scheme which the creator, John Hunter, optimized for display in publications rather than the web.

I spent some time over the weekend to refine the default colors and settings for my matplotlib installation. The result of this work is embodied in this .matplotlibrc color theme file. If you want graphs that look like the ones below by default, download it and place the file under ~/.matplotlib/matplotlibrc.





6 responses so far

  1. Perone says:

    Nice scheme, thanx.
    PS: The links for ggplot2 and Matplotlib are inverted.

  2. David Brailovsky says:

    Very cool!
    since I’m running on windows, had to change the “backend” field in the file to “TkAgg”

  3. Huy says:

    @Perone Thanks, I just switched the links. Glad you guys like it.

  4. Paolo says:

    Very nice!
    If you need more choices the RcolorBrewer package for R and the http://colorbrewer2.org/ website can be of some inspiration.

    HIH!

  5. Johnny Gill says:

    Thanks, I do like these colours.

    Incidentally, I believe that the matplotlib colour scheme was designed to be familiar to users of matlab.

Leave a reply