├── .gitignore
├── LICENSE
├── README.md
├── examples
├── MS2003.png
├── MS2003.svg
├── MS2007.png
├── MS2007.svg
├── clean.png
├── clean.svg
├── minimalist.png
├── minimalist.svg
├── neon.png
├── neon.svg
├── nicoguaro-doc.png
├── nicoguaro-doc.svg
├── tiestos.png
├── tiestos.svg
├── vintage.png
└── vintage.svg
├── img
└── sin_cos-ex.svg
├── matplotlib_styles.py
└── styles
├── MS2003.mplstyle
├── MS2007.mplstyle
├── clean.mplstyle
├── minimalist.mplstyle
├── neon.mplstyle
├── nicoguaro-doc.mplstyle
├── tiestos.mplstyle
└── vintage.mplstyle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 | MANIFEST
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 | .pytest_cache/
49 |
50 | # Translations
51 | *.mo
52 | *.pot
53 |
54 | # Django stuff:
55 | *.log
56 | local_settings.py
57 | db.sqlite3
58 |
59 | # Flask stuff:
60 | instance/
61 | .webassets-cache
62 |
63 | # Scrapy stuff:
64 | .scrapy
65 |
66 | # Sphinx documentation
67 | docs/_build/
68 |
69 | # PyBuilder
70 | target/
71 |
72 | # Jupyter Notebook
73 | .ipynb_checkpoints
74 |
75 | # pyenv
76 | .python-version
77 |
78 | # celery beat schedule file
79 | celerybeat-schedule
80 |
81 | # SageMath parsed files
82 | *.sage.py
83 |
84 | # Environments
85 | .env
86 | .venv
87 | env/
88 | venv/
89 | ENV/
90 | env.bak/
91 | venv.bak/
92 |
93 | # Spyder project settings
94 | .spyderproject
95 | .spyproject
96 |
97 | # Rope project settings
98 | .ropeproject
99 |
100 | # mkdocs documentation
101 | /site
102 |
103 | # mypy
104 | .mypy_cache/
105 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Nicolás Guarín-Zapata
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Matplotlib style sheets
2 |
3 | This repository was inspired by a post on [my blog](https://nicoguaro.github.io/posts/matplotlib_styles/) related to
4 | the use of style sheets on Matplotlib. The main idea is to create a file with
5 | some of the parameters that want to be defined.
6 |
7 | ## How to use it?
8 | You can use the URL for the style sheet in Python, as the example below.
9 |
10 | ```python
11 | import numpy as np
12 | import matplotlib.pyplot as plt
13 |
14 | repo = "https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/master"
15 | style = repo + "/styles/clean.mplstyle"
16 | with plt.style.context(style):
17 | x = np.linspace(0, 4, 201)
18 | cos = np.cos(np.pi*x)
19 | sin = np.sin(np.pi*x)
20 | plt.plot(x, sin, x, cos)
21 | plt.xlabel("x")
22 | plt.ylabel("y")
23 | plt.savefig("sin_cos-ex.svg")
24 | ```
25 |
26 | You should get the following result
27 |
28 |
31 |
32 | ## How to contribute?
33 |
34 | If you want to add style sheets to the repository in some of the groups you can
35 | create a Pull Request with the new file under the folder ``styles``.
36 |
37 | ## License
38 |
39 | Style sheets and code are availabe under [MIT license](https://opensource.org/licenses/mit-license.php).
40 |
--------------------------------------------------------------------------------
/examples/MS2003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/a5bb4d9487bb321912d037cdebb6fd866d9e46f7/examples/MS2003.png
--------------------------------------------------------------------------------
/examples/MS2003.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
1107 |
--------------------------------------------------------------------------------
/examples/MS2007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/a5bb4d9487bb321912d037cdebb6fd866d9e46f7/examples/MS2007.png
--------------------------------------------------------------------------------
/examples/MS2007.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
1089 |
--------------------------------------------------------------------------------
/examples/clean.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/a5bb4d9487bb321912d037cdebb6fd866d9e46f7/examples/clean.png
--------------------------------------------------------------------------------
/examples/clean.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
1089 |
--------------------------------------------------------------------------------
/examples/minimalist.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/a5bb4d9487bb321912d037cdebb6fd866d9e46f7/examples/minimalist.png
--------------------------------------------------------------------------------
/examples/minimalist.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
1029 |
--------------------------------------------------------------------------------
/examples/neon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/a5bb4d9487bb321912d037cdebb6fd866d9e46f7/examples/neon.png
--------------------------------------------------------------------------------
/examples/neon.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
1029 |
--------------------------------------------------------------------------------
/examples/nicoguaro-doc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/a5bb4d9487bb321912d037cdebb6fd866d9e46f7/examples/nicoguaro-doc.png
--------------------------------------------------------------------------------
/examples/tiestos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/a5bb4d9487bb321912d037cdebb6fd866d9e46f7/examples/tiestos.png
--------------------------------------------------------------------------------
/examples/vintage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicoguaro/matplotlib_styles/a5bb4d9487bb321912d037cdebb6fd866d9e46f7/examples/vintage.png
--------------------------------------------------------------------------------
/img/sin_cos-ex.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
925 |
--------------------------------------------------------------------------------
/matplotlib_styles.py:
--------------------------------------------------------------------------------
1 | """
2 | Generate examples for all available styles in the repository
3 |
4 | """
5 | import numpy as np
6 | import matplotlib.pyplot as plt
7 | import os
8 |
9 | folder_in = "styles/"
10 | folder_out = "examples/"
11 | styles = os.listdir(folder_in)
12 | for style in styles:
13 | with plt.style.context(folder_in + style):
14 | x = np.linspace(0, 4, 100)
15 | y = np.sin(np.pi*x + 1e-6)/(np.pi*x + 1e-6)
16 | fig = plt.figure()
17 | ax = plt.subplot(111)
18 | for cont in range(5):
19 | plt.plot(x, y/(cont + 1), label=cont)
20 | box = ax.get_position()
21 | ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])
22 | plt.legend(bbox_to_anchor=(1, 0.5))
23 | fname = style.replace("mplstyle", "svg")
24 | plt.savefig(folder_out + fname, bbox_inches="tight")
25 | fname = style.replace("mplstyle", "png")
26 | plt.savefig(folder_out + fname, bbox_inches="tight", dpi=300)
27 |
--------------------------------------------------------------------------------
/styles/MS2003.mplstyle:
--------------------------------------------------------------------------------
1 | # file: MS2003.mplstyle
2 | # author: Nicolas Guarin-Zapata
3 | # description: style sheet for Matplotlib figures.
4 | #
5 | # Color palette from:
6 | # http://www.officewriter.com/blog/2013/05/08/excels-color-palette-explained
7 |
8 |
9 | font.family : sans-serif
10 |
11 | axes.facecolor : c0c0c0
12 | axes.edgecolor : black
13 | axes.prop_cycle : cycler('color',['000080', 'FF00FF', 'FFFF00','00FFFF','800080', '800000', '008080', '0000FF'])
14 | axes.grid : True
15 |
16 | axes.spines.left : True
17 | axes.spines.bottom : True
18 | axes.spines.top : True
19 | axes.spines.right : True
20 |
21 | grid.color : black
22 | grid.linestyle : -
23 |
24 | lines.linewidth : 1
25 |
26 | figure.figsize : 5, 3
27 |
28 | legend.fancybox : False
29 | legend.frameon : True
30 | legend.facecolor : white
31 | legend.edgecolor : black
32 | legend.loc : center left
33 |
--------------------------------------------------------------------------------
/styles/MS2007.mplstyle:
--------------------------------------------------------------------------------
1 | # file: MS2007.mplstyle
2 | # author: Nicolas Guarin-Zapata
3 | # description: style sheet for Matplotlib figures.
4 | #
5 | # Color palette from:
6 | # http://analyticsdemystified.com/excel-tips/data-visualization-that-is-color-blind-friendly-excel-2007/
7 |
8 |
9 | font.family : sans-serif
10 |
11 | axes.facecolor : white
12 | axes.edgecolor : 4d4d4d
13 | axes.prop_cycle : cycler('color',['4573a7', 'aa4644', '89a54e', '71588f','4298af', 'db843d', '93a9d0', 'd09392'])
14 | axes.grid : True
15 | axes.linewidth : 0.5
16 |
17 | axes.spines.left : True
18 | axes.spines.bottom : True
19 | axes.spines.top : False
20 | axes.spines.right : False
21 |
22 | lines.linewidth : 2
23 |
24 | grid.color : 4d4d4d
25 | grid.linestyle : -
26 | grid.linewidth : 0.5
27 |
28 | figure.figsize : 5, 3
29 |
30 | legend.fancybox : False
31 | legend.frameon : False
32 | legend.facecolor : white
33 | legend.edgecolor : 4d4d4d
34 | legend.loc : center left
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/styles/clean.mplstyle:
--------------------------------------------------------------------------------
1 | # file: clean.mplstyle
2 | # author: Nicolas Guarin-Zapata
3 | # description: style sheet for Matplotlib figures.
4 | #
5 | # Color palette from:
6 | # http://colorbrewer2.org/#type=qualitative&scheme=Set1&n=8
7 |
8 |
9 | font.family : sans-serif
10 |
11 | axes.facecolor : white
12 | axes.prop_cycle : cycler('color',['e41a1c', '377eb8', '4daf4a', '984ea3', 'ff7f00', 'ffff33', 'a65628', 'f781bf'])
13 | axes.linewidth : 0.0
14 | axes.grid : True
15 |
16 | lines.linewidth : 1.5
17 |
18 | xtick.direction : in
19 | ytick.direction : in
20 |
21 | grid.color : c7dedf
22 | grid.linestyle : -
23 | grid.linewidth : 0.3
24 |
25 | figure.figsize : 6, 4
26 |
27 | legend.fancybox : False
28 | legend.frameon : False
29 | legend.loc : best
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/styles/minimalist.mplstyle:
--------------------------------------------------------------------------------
1 | # Stylesheet for matplotlib
2 | #
3 | # Author: Nicolas Guarin-Zapata
4 | # Date: September 2018
5 |
6 | ### Math Text
7 | mathtext.fontset : cm
8 |
9 | ### Text
10 | text.color : 757575
11 | font.size : 10
12 |
13 | ### Ticks
14 | xtick.color : 757575
15 | ytick.color : 757575
16 |
17 | ### Axes
18 | axes.labelcolor : 757575
19 | axes.edgecolor : 757575
20 | axes.spines.right : False
21 | axes.spines.top : False
22 | axes.prop_cycle : cycler('color', ['348ABD', '7A68A6', 'A60628', '467821', 'CF4457', '188487', 'E24A33'])
23 |
24 | ### Lines
25 | lines.linewidth : 1.5
26 |
27 | ### Figures
28 | figure.figsize : 4, 3
29 |
30 | ### Legends
31 | legend.fancybox : False
32 | legend.frameon : False
33 |
--------------------------------------------------------------------------------
/styles/neon.mplstyle:
--------------------------------------------------------------------------------
1 | # Stylesheet for matplotlib
2 | #
3 | # Author: Nicolas Guarin-Zapata
4 | # Date: September 2019
5 |
6 |
7 | ### Text
8 | text.color : D9D9D9
9 | font.size : 10
10 | font.family : sans-serif
11 |
12 |
13 | ### Ticks
14 | xtick.color : D9D9D9
15 | ytick.color : D9D9D9
16 |
17 | ### Axes
18 | axes.labelcolor : D9D9D9
19 | axes.edgecolor : D9D9D9
20 | axes.facecolor : 333333
21 | axes.prop_cycle : cycler('color', ['04D9D9', 'F241A3', 'FA851E', 'BFD91A', 'D9D9D9', '1AA0D9', 'E62F53', 'FEED00'])
22 |
23 |
24 | ### Lines
25 | lines.linewidth : 2.0
26 |
27 | ### Figures
28 | figure.figsize : 4, 3
29 | figure.facecolor : 333333
30 |
31 | ### Legends
32 | legend.fancybox : False
33 | legend.frameon : False
34 |
35 | ### Saving figures
36 | savefig.facecolor : 333333
37 |
--------------------------------------------------------------------------------
/styles/nicoguaro-doc.mplstyle:
--------------------------------------------------------------------------------
1 | # file: nicoguaro-doc.mplstyle
2 | # author: Nicolas Guarin-Zapata
3 | # description: style sheet for Matplotlib figures.
4 |
5 |
6 | font.family : serif
7 | font.style : normal
8 | font.weight : normal
9 | font.size : 14
10 |
11 | text.color : black
12 | text.usetex : False
13 |
14 | axes.facecolor : E5E5E5
15 | axes.edgecolor : bcbcbc
16 | axes.labelsize : 14
17 | axes.labelcolor : black
18 | axes.linewidth : 0.0
19 | axes.titlesize : 14
20 | axes.prop_cycle : cycler('color', ['348ABD', '7A68A6', 'A60628', '467821', 'CF4457', '188487', 'E24A33'])
21 |
22 | lines.linewidth : 1.0
23 | lines.linestyle : -
24 | lines.markersize : 6
25 | lines.markeredgewidth : 0.0
26 |
27 | patch.edgecolor : white
28 |
29 | xtick.color : black
30 | xtick.direction : in
31 | xtick.labelsize : 14
32 |
33 | ytick.color : black
34 | ytick.direction : in
35 | ytick.labelsize : 14
36 |
37 | grid.color : white
38 | grid.linestyle : -
39 | grid.linewidth : 1.0
40 |
41 | figure.figsize : 7, 5
42 | figure.facecolor : white
43 | figure.edgecolor : black
44 | figure.dpi : 100
45 | figure.autolayout : True
46 |
47 | legend.fancybox : True
48 | legend.frameon : True
49 | legend.fontsize : 12
50 | legend.loc : best
51 |
52 | savefig.dpi : 300
53 |
--------------------------------------------------------------------------------
/styles/tiestos.mplstyle:
--------------------------------------------------------------------------------
1 | # Stylesheet for Matplotlib
2 | #
3 | # Author: Nicolas Guarin-Zapata
4 | # Date: June 2024
5 |
6 | ### Math Text
7 | mathtext.fontset : cm
8 |
9 | ### Text
10 | text.color : 757575
11 | font.size : 10
12 | font.family : sans-serif
13 | font.sans-serif: Open Sans
14 |
15 | ### Ticks
16 | xtick.color : 757575
17 | ytick.color : 757575
18 |
19 | ### Axes
20 | axes.labelcolor : 757575
21 | axes.edgecolor : 757575
22 | axes.spines.right : False
23 | axes.spines.top : False
24 | axes.prop_cycle : cycler('color', ['E574BC', '028090', 'FE5D26', '1C1F33', 'C1F7DC'])
25 | axes.linewidth : 1.0
26 |
27 | ### Lines
28 | lines.linewidth : 2.0
29 |
30 | ### Figures
31 | figure.figsize : 5.5, 3.5
32 | figure.autolayout : True
33 |
34 | ### Images
35 | image.cmap: magma
36 | image.lut: 24
37 |
38 | ### Legends
39 | legend.fancybox : False
40 | legend.frameon : False
41 |
42 | ### Saving figures
43 | savefig.dpi : 300
--------------------------------------------------------------------------------
/styles/vintage.mplstyle:
--------------------------------------------------------------------------------
1 | # Stylesheet for matplotlib
2 | #
3 | # Author: Nicolas Guarin-Zapata
4 | # Date: April 2020
5 |
6 |
7 | ### Text
8 | text.color : 1A1A1A
9 | font.size : 12
10 | font.family : serif
11 | font.serif : Computer Modern Roman
12 |
13 | ### Ticks
14 | xtick.color : 1A1A1A
15 | ytick.color : 1A1A1A
16 |
17 | ### Axes
18 | axes.labelcolor : 1A1A1A
19 | axes.edgecolor : 1A1A1A
20 | axes.facecolor : FDF4D9
21 | axes.prop_cycle : cycler('color', ['b12d44', '4c5684', '137e93', 'b2b745', 'eb5f32', 'fcc30d'])
22 | axes.linewidth : 1.0
23 | axes.grid : True
24 | axes.autolimit_mode : round_numbers #data
25 | axes.xmargin : 0.0
26 | axes.ymargin : 0.0
27 |
28 | ### Grids
29 | grid.color : bdcbc8
30 | grid.linestyle : -
31 | grid.linewidth : 0.5
32 |
33 |
34 | ### Lines
35 | lines.linewidth : 2.0
36 |
37 | ### Figures
38 | figure.figsize : 8, 5
39 | figure.facecolor : FDF4D9
40 |
41 | ### Legends
42 | legend.fancybox : True
43 | legend.frameon : True
44 | legend.edgecolor : bdcbc8
45 | legend.facecolor : white
46 | legend.loc : best
47 |
48 | ### Saving figures
49 | savefig.facecolor : FDF4D9
50 |
--------------------------------------------------------------------------------