Skip to content

nicoguaro/matplotlib_styles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matplotlib style sheets

This repository was inspired by a post on my blog related to the use of style sheets on Matplotlib. The main idea is to create a file with some of the parameters that want to be defined.

How to use it?

You can use the URL for the style sheet in Python, as the example below.

import numpy as np
import matplotlib.pyplot as plt

repo = "https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/master"
style = repo + "/styles/clean.mplstyle"
with plt.style.context(style):
    x = np.linspace(0, 4, 201)
    cos = np.cos(np.pi*x)
    sin = np.sin(np.pi*x)
    plt.plot(x, sin, x, cos)
    plt.xlabel("x")
    plt.ylabel("y")
    plt.savefig("sin_cos-ex.svg")

You should get the following result

Example of use of style sheets

How to contribute?

If you want to add style sheets to the repository in some of the groups you can create a Pull Request with the new file under the folder styles.

License

Style sheets and code are availabe under MIT license.

About

Matplotlib style sheets allow to stylize plots easily.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages