Back to Resources


The repository linked below contains several Matplotlib style sheets designed to help you brat-ify your python plots. BRAT's cover font uses Arial Narrow, which you will need in order to fully embrace the aesthetic (assuming that's your goal). If your Mac has Microsoft Office installed, you should already have this font on your system.

  1. Download the GitHub repository by clicking the link and selecting CodeDownload ZIP.
  2. When you installed Matplotlib, it came with several built-in style sheets kept in a folder named stylelib. To install the following brat-inspired style sheets, you'll need to find where on your computer that stylelib folder is located:
    
        import matplotlib
        print(matplotlib.get_data_path())
        
    For my install, the stylelib folder is here:
    
        ~/anaconda3/lib/python3.11/site-packages/matplotlib/mpl-data
        
  3. Unzip the GitHub repository and move its contents to the stylelib folder. You can use Finder and select GoGo to Folder... to quickly navigate to the stylelib folder.
  4. The style sheets are ready to be used! You can try plotting the following, if you don't already have some code to test:
    
        # --- imports
        import matplotlib.pyplot as plt
        import numpy as np
        
        # --- data
        x = np.linspace(0, 10, 100)
        sin = np.sin(x)
        cos = np.cos(x)
        
        # --- plot
        plt.figure(figsize=(10, 6))
        plt.plot(x, sin, label='sine wave')
        plt.scatter(x, cos, label='cosine wave')
        
        # --- plot settings
        plt.title('plot title')
        plt.xlabel('x-axis label')
        plt.ylabel('y-axis label')
        plt.legend()
        
  5. To use a style sheet, include one of the following commands in your code:

    BRAT (2024)

    
        plt.style.use('brat')
        


    CRASH (2022)

    
        plt.style.use('crash')
        


    how i'm feeling now (2020)

    
        plt.style.use('how-im-feeling-now')
        


    Charli (2019)

    
        plt.style.use('charli')
        


    Pop 2 (2017)

    
        plt.style.use('pop-2')
        


    Number 1 Angel (2017)

    
        plt.style.use('number-1-angel')
        


    SUCKER (2014)

    
        plt.style.use('sucker')
        


    True Romance (2013)

    
        plt.style.use('true-romance')