thriveth / gruvbox-mpl

Dark Gruvbox style for Matplotlib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A gruvbox style for Matplotlib

A simple, dark-background color style for the Matplotlib plotting library for Python, based on Pavel Pertsevs Gruvbox color palette and theme, that I have mainly made to fit in to my Emacs/org-mode theme.

I may include the light-background Gruvbox variant later, but I mainly made this to have a good dark-background style.

I made this based on this blog post Héloïse Stevance (@sydonahi on Twitter), and adding a bit of extra spice.

Screenshots

This is what a simple multi line plot looks like. The data used are filter throughput curves for the UVIS and IR channels at the Hubble Space Telescope.

screenshots/HSTFilterPlot.png

a screenshot of an org-mode session, playing with galaxy SED fitting with Bagpipes:

screenshots/org-mode-session.png

Installation

To try it out, place the file gruvbox.mplstyle in the folder you are working in, and insert the lines:

import matplotlib.pyplot as plt
plt.style.use('gruvbox.mplstyle')

to your script or notebook.

To make it available from anywhere, follow the instructions in the blog post linked above.

Misc.

  • The theme sets a background color for the figure canvas and one for the Axes. If you want the figure canvas to be transparent, set:
    import matplotlib.pyplot as plt
    plt.rcParams['figure.facecolor'] = 'none'
        

    somewhere in your working code, or comment out the corresponding line in the .mplstyle file to get rid of it for good.

About

Dark Gruvbox style for Matplotlib