morethemes 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Joseph Barbier
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
+
23
+ Fonts included in this package are licensed under different licenses. See fonts/LICENSE for details.
@@ -0,0 +1 @@
1
+ include morethemes/fonts/*.ttf
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.2
2
+ Name: morethemes
3
+ Version: 0.1.0
4
+ Summary: More themes for matplotlib
5
+ Home-page: https://github.com/JosephBARBIERDARNAL/morethemes
6
+ Author: Joseph Barbier
7
+ Author-email: joseph.barbierdarnal@gmail.com
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: matplotlib>=3.6.0
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: home-page
15
+
16
+
17
+ <!-- Automatically generated, do not change by hand. Use docs/script/make.py instead. -->
18
+
19
+ # `morethemes`: more themes for matplotlib
20
+
21
+ `morethemes` provides themes for [matplotlib](https://matplotlib.org/). More themes, better plots. One line of code.
22
+
23
+ [Documentation site](https://josephbarbierdarnal.github.io/morethemes/)
24
+
25
+ <br>
26
+
27
+ ## Themes
28
+
29
+
30
+ ### Darker
31
+
32
+ ```python
33
+ import morethemes as mt
34
+ mt.set_theme("darker")
35
+ ```
36
+
37
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/darker.png)](https://josephbarbierdarnal.github.io/morethemes/)
38
+
39
+
40
+ ### Yellowish
41
+
42
+ ```python
43
+ import morethemes as mt
44
+ mt.set_theme("yellowish")
45
+ ```
46
+
47
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/yellowish.png)](https://josephbarbierdarnal.github.io/morethemes/)
48
+
49
+
50
+ ### Urban
51
+
52
+ ```python
53
+ import morethemes as mt
54
+ mt.set_theme("urban")
55
+ ```
56
+
57
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/urban.png)](https://josephbarbierdarnal.github.io/morethemes/)
58
+
59
+
60
+ ### WSJ
61
+
62
+ ```python
63
+ import morethemes as mt
64
+ mt.set_theme("wsj")
65
+ ```
66
+
67
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/wsj.png)](https://josephbarbierdarnal.github.io/morethemes/)
68
+
69
+
70
+ ### Economist
71
+
72
+ ```python
73
+ import morethemes as mt
74
+ mt.set_theme("economist")
75
+ ```
76
+
77
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/economist.png)](https://josephbarbierdarnal.github.io/morethemes/)
78
+
79
+
80
+ ### Minimal
81
+
82
+ ```python
83
+ import morethemes as mt
84
+ mt.set_theme("minimal")
85
+ ```
86
+
87
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/minimal.png)](https://josephbarbierdarnal.github.io/morethemes/)
88
+
89
+
90
+
91
+ <br>
92
+
93
+ ## Installation
94
+
95
+ ```bash
96
+ pip install morethemes
97
+ ```
98
+
99
+
100
+ <br>
101
+
102
+ ## Learn matplotlib
103
+
104
+ This project is sponsored by [Matplotlib Journey](https://www.matplotlib-journey.com/), an online course designed to make you a matplotlib expert. If you're interested in learning matplotlib, have a look!
105
+
106
+ <center>
107
+
108
+ [**Join the course**](https://www.matplotlib-journey.com/)
109
+
110
+ </center>
111
+
112
+ <br>
113
+
@@ -0,0 +1,98 @@
1
+
2
+ <!-- Automatically generated, do not change by hand. Use docs/script/make.py instead. -->
3
+
4
+ # `morethemes`: more themes for matplotlib
5
+
6
+ `morethemes` provides themes for [matplotlib](https://matplotlib.org/). More themes, better plots. One line of code.
7
+
8
+ [Documentation site](https://josephbarbierdarnal.github.io/morethemes/)
9
+
10
+ <br>
11
+
12
+ ## Themes
13
+
14
+
15
+ ### Darker
16
+
17
+ ```python
18
+ import morethemes as mt
19
+ mt.set_theme("darker")
20
+ ```
21
+
22
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/darker.png)](https://josephbarbierdarnal.github.io/morethemes/)
23
+
24
+
25
+ ### Yellowish
26
+
27
+ ```python
28
+ import morethemes as mt
29
+ mt.set_theme("yellowish")
30
+ ```
31
+
32
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/yellowish.png)](https://josephbarbierdarnal.github.io/morethemes/)
33
+
34
+
35
+ ### Urban
36
+
37
+ ```python
38
+ import morethemes as mt
39
+ mt.set_theme("urban")
40
+ ```
41
+
42
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/urban.png)](https://josephbarbierdarnal.github.io/morethemes/)
43
+
44
+
45
+ ### WSJ
46
+
47
+ ```python
48
+ import morethemes as mt
49
+ mt.set_theme("wsj")
50
+ ```
51
+
52
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/wsj.png)](https://josephbarbierdarnal.github.io/morethemes/)
53
+
54
+
55
+ ### Economist
56
+
57
+ ```python
58
+ import morethemes as mt
59
+ mt.set_theme("economist")
60
+ ```
61
+
62
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/economist.png)](https://josephbarbierdarnal.github.io/morethemes/)
63
+
64
+
65
+ ### Minimal
66
+
67
+ ```python
68
+ import morethemes as mt
69
+ mt.set_theme("minimal")
70
+ ```
71
+
72
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/minimal.png)](https://josephbarbierdarnal.github.io/morethemes/)
73
+
74
+
75
+
76
+ <br>
77
+
78
+ ## Installation
79
+
80
+ ```bash
81
+ pip install morethemes
82
+ ```
83
+
84
+
85
+ <br>
86
+
87
+ ## Learn matplotlib
88
+
89
+ This project is sponsored by [Matplotlib Journey](https://www.matplotlib-journey.com/), an online course designed to make you a matplotlib expert. If you're interested in learning matplotlib, have a look!
90
+
91
+ <center>
92
+
93
+ [**Join the course**](https://www.matplotlib-journey.com/)
94
+
95
+ </center>
96
+
97
+ <br>
98
+
@@ -0,0 +1,4 @@
1
+ from .main import set_theme, ALL_THEMES
2
+ from .preview import preview_theme
3
+
4
+ __all__ = ["set_theme", "preview_theme", "ALL_THEMES"]
@@ -0,0 +1,13 @@
1
+ import os
2
+ from matplotlib import font_manager
3
+
4
+ PACKAGE_DIR = os.path.dirname(os.path.abspath(__file__))
5
+
6
+
7
+ def set_family_from_file(file):
8
+ font_path = os.path.join(PACKAGE_DIR, "fonts", file)
9
+ if not os.path.isfile(font_path):
10
+ raise ValueError(f"Font file not found: {font_path}")
11
+ font_prop = font_manager.FontProperties(fname=font_path)
12
+ font_manager.fontManager.addfont(font_path)
13
+ return font_prop.get_name()
@@ -0,0 +1,36 @@
1
+ import matplotlib as mpl
2
+ import matplotlib.pyplot as plt
3
+ from difflib import get_close_matches
4
+
5
+ from .themes import ALL_THEMES
6
+
7
+
8
+ def set_theme(theme_name, reset_to_default=True):
9
+ """
10
+ Apply a dictionary of rcParams to the global matplotlib configuration.
11
+
12
+ Parameters
13
+ ----------
14
+ theme_name : str
15
+ Name of the theme to apply (case insensitive).
16
+ reset_to_default : bool
17
+ Whether to first reset to default matplotlib theme before applying the theme.
18
+ If not, themes can stack on top of each other.
19
+ """
20
+ if theme_name == "default":
21
+ plt.rcParams.update(mpl.rcParamsDefault)
22
+ else:
23
+ theme_name = theme_name.lower()
24
+ try:
25
+ theme_dict = ALL_THEMES[theme_name]["theme"]
26
+ except KeyError:
27
+ suggestions = get_close_matches(
28
+ theme_name, ALL_THEMES.keys(), n=3, cutoff=0.01
29
+ )
30
+ raise KeyError(
31
+ f"Theme '{theme_name}' not found. Did you mean: {', '.join(suggestions)}?"
32
+ )
33
+ if reset_to_default:
34
+ plt.rcParams.update(mpl.rcParamsDefault)
35
+ for key, value in theme_dict.items():
36
+ plt.rcParams[key] = value
@@ -0,0 +1,33 @@
1
+ import matplotlib.pyplot as plt
2
+ import morethemes as mt
3
+ import numpy as np
4
+
5
+
6
+ def preview_theme(theme=None):
7
+ if theme is not None:
8
+ mt.set_theme(theme)
9
+ np.random.seed(0)
10
+
11
+ fig, axs = plt.subplots(ncols=2, nrows=2, figsize=(8, 5), layout="tight", dpi=200)
12
+
13
+ axs[0, 0].scatter(np.random.normal(size=100), np.random.normal(size=100), s=70)
14
+
15
+ for i in range(3):
16
+ np.random.seed(i)
17
+ axs[0, 1].plot(list(range(20)), np.random.normal(size=20), label=f"{i} line")
18
+ axs[0, 1].legend()
19
+
20
+ axs[1, 1].barh(
21
+ ["France", "Italy", "Germany", "Australia"], [1000, 2000, 3000, 2000]
22
+ )
23
+
24
+ axs[1, 0].pie(
25
+ [20, 40, 20, 20],
26
+ labels=["A", "B", "C", "D"],
27
+ explode=[0.08] * 4,
28
+ )
29
+ axs[1, 0].pie([1], colors=[fig.get_facecolor()], radius=0.5)
30
+
31
+ fig.text(x=0.5, y=1, s=f"Preview of theme: {theme}", size=20, ha="center")
32
+
33
+ return fig
@@ -0,0 +1,223 @@
1
+ from cycler import cycler
2
+ from morethemes.fonts import set_family_from_file
3
+
4
+ darker_theme = {
5
+ "name": "darker",
6
+ "description": "A sleek, no-frills dark theme with high contrast and a modern feel",
7
+ "author": "Joseph Barbier",
8
+ "theme": {
9
+ "font.family": set_family_from_file("Oswald.ttf"),
10
+ "axes.spines.top": False,
11
+ "axes.spines.right": False,
12
+ "xtick.minor.visible": False,
13
+ "xtick.major.size": 0,
14
+ "ytick.major.size": 0,
15
+ "ytick.minor.visible": False,
16
+ "scatter.marker": "H",
17
+ "lines.linewidth": 2.5,
18
+ "axes.labelsize": 12,
19
+ "axes.linewidth": 1.5,
20
+ "text.color": "#fff",
21
+ "axes.facecolor": "#282828",
22
+ "figure.facecolor": "#282828",
23
+ "axes.labelcolor": "#eeeeee",
24
+ "axes.edgecolor": "#eeeeee",
25
+ "xtick.color": "#eeeeee",
26
+ "ytick.color": "#eeeeee",
27
+ "axes.prop_cycle": cycler(
28
+ "color", ["#FED789", "#A4BED5", "#72874E", "#023743", "#476F84", "#453947"]
29
+ ),
30
+ },
31
+ }
32
+
33
+
34
+ yellowish_theme = {
35
+ "name": "yellowish",
36
+ "description": "A bold, National Geographic-inspired theme with a warm yellow backdrop",
37
+ "author": "Joseph Barbier",
38
+ "theme": {
39
+ "font.family": set_family_from_file("Delius.ttf"),
40
+ "ytick.minor.visible": False,
41
+ "xtick.minor.visible": False,
42
+ "xtick.major.size": 0,
43
+ "ytick.major.size": 0,
44
+ "axes.spines.top": False,
45
+ "axes.spines.right": False,
46
+ "ytick.major.pad": 5,
47
+ "xtick.major.pad": 5,
48
+ "axes.grid": True,
49
+ "grid.linewidth": 0.6,
50
+ "grid.alpha": 0.6,
51
+ "grid.linestyle": "-",
52
+ "grid.color": "#bcbcbc",
53
+ "axes.edgecolor": "#be1414",
54
+ "axes.labelcolor": "#be1414",
55
+ "axes.titlecolor": "#be1414",
56
+ "text.color": "#be1414",
57
+ "axes.facecolor": "#ffcc04",
58
+ "figure.facecolor": "#ffcc04",
59
+ "axes.linewidth": 1.2,
60
+ "axes.prop_cycle": cycler(
61
+ "color", ["#000000", "#555555", "#7e7e7e", "#b1b1b1", "#ececec"]
62
+ ),
63
+ },
64
+ }
65
+
66
+ urban_theme = {
67
+ "name": "urban",
68
+ "description": "A clean, professional theme featuring the Urbanist font and muted tones.",
69
+ "author": "Joseph Barbier",
70
+ "theme": {
71
+ "font.family": set_family_from_file("Urbanist.ttf"),
72
+ "ytick.minor.visible": False,
73
+ "xtick.minor.visible": False,
74
+ "xtick.major.size": 0,
75
+ "ytick.major.size": 0,
76
+ "ytick.major.pad": 5,
77
+ "xtick.major.pad": 5,
78
+ "axes.spines.top": False,
79
+ "axes.spines.right": False,
80
+ "axes.grid": True,
81
+ "grid.linewidth": 0.6,
82
+ "grid.alpha": 0.1,
83
+ "grid.linestyle": "-",
84
+ "axes.linewidth": 1.2,
85
+ "grid.color": "#1e1d1d",
86
+ "axes.edgecolor": "#efefef",
87
+ "axes.facecolor": "#efefef",
88
+ "figure.facecolor": "#efefef",
89
+ "axes.prop_cycle": cycler(
90
+ "color", ["#F56455", "#15134B", "#87C785", "#572F30"]
91
+ ),
92
+ },
93
+ }
94
+
95
+ wsj_theme = {
96
+ "name": "wsj",
97
+ "description": "A refined, newspaper-style theme inspired by the Wall Street Journal.",
98
+ "author": "Joseph Barbier",
99
+ "theme": {
100
+ "font.family": set_family_from_file("Crimson.ttf"),
101
+ "ytick.minor.visible": False,
102
+ "xtick.minor.visible": False,
103
+ "xtick.major.size": 0,
104
+ "ytick.major.size": 0,
105
+ "axes.spines.top": False,
106
+ "axes.spines.right": False,
107
+ "axes.spines.left": False,
108
+ "ytick.major.pad": 5,
109
+ "xtick.major.pad": 5,
110
+ "axes.grid": True,
111
+ "grid.linewidth": 0.8,
112
+ "grid.linestyle": "-",
113
+ "axes.linewidth": 1.2,
114
+ "grid.alpha": 0.1,
115
+ "grid.color": "#1e1d1d",
116
+ "axes.edgecolor": "#1f1f1f",
117
+ "axes.facecolor": "#f8ecdc",
118
+ "figure.facecolor": "#f8ecdc",
119
+ "axes.prop_cycle": cycler(
120
+ "color",
121
+ [
122
+ "#855C75",
123
+ "#D9AF6B",
124
+ "#AF6458",
125
+ "#736F4C",
126
+ "#526A83",
127
+ "#625377",
128
+ "#68855C",
129
+ "#9C9C5E",
130
+ "#A06177",
131
+ "#8C785D",
132
+ "#467378",
133
+ "#7C7C7C",
134
+ ],
135
+ ),
136
+ },
137
+ }
138
+
139
+ economist_theme = {
140
+ "name": "economist",
141
+ "description": "A crisp, data-focused theme with subtle gridlines and sharp contrasts.",
142
+ "author": "Joseph Barbier",
143
+ "theme": {
144
+ "font.family": set_family_from_file("RobotoFlex.ttf"),
145
+ "ytick.minor.visible": False,
146
+ "xtick.minor.visible": True,
147
+ "xtick.major.size": 6,
148
+ "xtick.minor.size": 3,
149
+ "ytick.major.size": 0,
150
+ "axes.spines.top": False,
151
+ "axes.spines.right": False,
152
+ "axes.spines.left": False,
153
+ "ytick.major.pad": 5,
154
+ "xtick.major.pad": 5,
155
+ "axes.grid": True,
156
+ "grid.linewidth": 0.4,
157
+ "grid.linestyle": "-",
158
+ "axes.linewidth": 1.2,
159
+ "axes.grid.axis": "y",
160
+ "text.color": "#3d3d3d",
161
+ "grid.color": "#989797",
162
+ "axes.edgecolor": "#1f1f1f",
163
+ "axes.facecolor": "#e8f4f4",
164
+ "figure.facecolor": "#e8f4f4",
165
+ "axes.prop_cycle": cycler(
166
+ "color",
167
+ [
168
+ "#DB444B",
169
+ "#006BA2",
170
+ "#3EBCD2",
171
+ "#379A8B",
172
+ "#EBB434",
173
+ "#B4BA39",
174
+ "#9A607F",
175
+ "#D1B07C",
176
+ "#758D99",
177
+ ],
178
+ ),
179
+ },
180
+ }
181
+
182
+ minimal_theme = {
183
+ "name": "minimal",
184
+ "description": "A pure, distraction-free theme with a simple monochrome palette.",
185
+ "author": "Joseph Barbier",
186
+ "theme": {
187
+ "font.family": set_family_from_file("Inter.ttf"),
188
+ "ytick.minor.visible": False,
189
+ "xtick.minor.visible": False,
190
+ "xtick.major.size": 0,
191
+ "ytick.major.size": 0,
192
+ "axes.spines.top": False,
193
+ "axes.spines.right": False,
194
+ "axes.spines.left": False,
195
+ "axes.spines.bottom": False,
196
+ "ytick.major.pad": 5,
197
+ "xtick.major.pad": 5,
198
+ "axes.grid": True,
199
+ "grid.linewidth": 0.8,
200
+ "grid.linestyle": "-",
201
+ "grid.alpha": 0.1,
202
+ "axes.linewidth": 1.2,
203
+ "grid.color": "#383838",
204
+ "text.color": "#000000",
205
+ "axes.edgecolor": "#000000",
206
+ "axes.facecolor": "#ffffff",
207
+ "figure.facecolor": "#ffffff",
208
+ "axes.prop_cycle": cycler(
209
+ "color",
210
+ ["#678096", "#ACC2CF", "#CD5733", "#979461", "#A12A19"],
211
+ ),
212
+ },
213
+ }
214
+
215
+
216
+ ALL_THEMES = {
217
+ "darker": darker_theme,
218
+ "yellowish": yellowish_theme,
219
+ "urban": urban_theme,
220
+ "wsj": wsj_theme,
221
+ "economist": economist_theme,
222
+ "minimal": minimal_theme,
223
+ }
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.2
2
+ Name: morethemes
3
+ Version: 0.1.0
4
+ Summary: More themes for matplotlib
5
+ Home-page: https://github.com/JosephBARBIERDARNAL/morethemes
6
+ Author: Joseph Barbier
7
+ Author-email: joseph.barbierdarnal@gmail.com
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: matplotlib>=3.6.0
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: home-page
15
+
16
+
17
+ <!-- Automatically generated, do not change by hand. Use docs/script/make.py instead. -->
18
+
19
+ # `morethemes`: more themes for matplotlib
20
+
21
+ `morethemes` provides themes for [matplotlib](https://matplotlib.org/). More themes, better plots. One line of code.
22
+
23
+ [Documentation site](https://josephbarbierdarnal.github.io/morethemes/)
24
+
25
+ <br>
26
+
27
+ ## Themes
28
+
29
+
30
+ ### Darker
31
+
32
+ ```python
33
+ import morethemes as mt
34
+ mt.set_theme("darker")
35
+ ```
36
+
37
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/darker.png)](https://josephbarbierdarnal.github.io/morethemes/)
38
+
39
+
40
+ ### Yellowish
41
+
42
+ ```python
43
+ import morethemes as mt
44
+ mt.set_theme("yellowish")
45
+ ```
46
+
47
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/yellowish.png)](https://josephbarbierdarnal.github.io/morethemes/)
48
+
49
+
50
+ ### Urban
51
+
52
+ ```python
53
+ import morethemes as mt
54
+ mt.set_theme("urban")
55
+ ```
56
+
57
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/urban.png)](https://josephbarbierdarnal.github.io/morethemes/)
58
+
59
+
60
+ ### WSJ
61
+
62
+ ```python
63
+ import morethemes as mt
64
+ mt.set_theme("wsj")
65
+ ```
66
+
67
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/wsj.png)](https://josephbarbierdarnal.github.io/morethemes/)
68
+
69
+
70
+ ### Economist
71
+
72
+ ```python
73
+ import morethemes as mt
74
+ mt.set_theme("economist")
75
+ ```
76
+
77
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/economist.png)](https://josephbarbierdarnal.github.io/morethemes/)
78
+
79
+
80
+ ### Minimal
81
+
82
+ ```python
83
+ import morethemes as mt
84
+ mt.set_theme("minimal")
85
+ ```
86
+
87
+ [![](https://raw.githubusercontent.com/JosephBARBIERDARNAL/morethemes/refs/heads/main/docs/img/minimal.png)](https://josephbarbierdarnal.github.io/morethemes/)
88
+
89
+
90
+
91
+ <br>
92
+
93
+ ## Installation
94
+
95
+ ```bash
96
+ pip install morethemes
97
+ ```
98
+
99
+
100
+ <br>
101
+
102
+ ## Learn matplotlib
103
+
104
+ This project is sponsored by [Matplotlib Journey](https://www.matplotlib-journey.com/), an online course designed to make you a matplotlib expert. If you're interested in learning matplotlib, have a look!
105
+
106
+ <center>
107
+
108
+ [**Join the course**](https://www.matplotlib-journey.com/)
109
+
110
+ </center>
111
+
112
+ <br>
113
+
@@ -0,0 +1,22 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ setup.py
6
+ morethemes/__init__.py
7
+ morethemes/fonts.py
8
+ morethemes/main.py
9
+ morethemes/preview.py
10
+ morethemes/themes.py
11
+ morethemes.egg-info/PKG-INFO
12
+ morethemes.egg-info/SOURCES.txt
13
+ morethemes.egg-info/dependency_links.txt
14
+ morethemes.egg-info/requires.txt
15
+ morethemes.egg-info/top_level.txt
16
+ morethemes/fonts/Crimson.ttf
17
+ morethemes/fonts/Delius.ttf
18
+ morethemes/fonts/Inter.ttf
19
+ morethemes/fonts/Oswald.ttf
20
+ morethemes/fonts/RobotoFlex.ttf
21
+ morethemes/fonts/Urbanist.ttf
22
+ tests/test_main.py
@@ -0,0 +1 @@
1
+ matplotlib>=3.6.0
@@ -0,0 +1 @@
1
+ morethemes
@@ -0,0 +1,19 @@
1
+ [project]
2
+ name = "morethemes"
3
+ version = "0.1.0"
4
+ description = "More themes for matplotlib"
5
+ readme = "README.md"
6
+ requires-python = ">=3.9"
7
+ dependencies = [
8
+ "matplotlib>=3.6.0",
9
+ ]
10
+
11
+ [dependency-groups]
12
+ dev = [
13
+ "pytest>=8.3.4",
14
+ "pre-commit>=4.0.1",
15
+ "setuptools>=75.8.0",
16
+ "mkdocs-material>=9.5.49",
17
+ ]
18
+ [tool.setuptools]
19
+ include-package-data = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,15 @@
1
+ from setuptools import setup
2
+
3
+ setup(
4
+ name="morethemes",
5
+ version="0.1.0",
6
+ packages=["morethemes"],
7
+ description="More themes for matplotlib",
8
+ long_description=open("README.md").read(),
9
+ long_description_content_type="text/markdown",
10
+ author="Joseph Barbier",
11
+ author_email="joseph.barbierdarnal@gmail.com",
12
+ url="https://github.com/JosephBARBIERDARNAL/morethemes",
13
+ install_requires=["matplotlib"],
14
+ include_package_data=True,
15
+ )
@@ -0,0 +1,36 @@
1
+ import matplotlib as mpl
2
+ import matplotlib.pyplot as plt
3
+ import pytest
4
+
5
+ import morethemes as mt
6
+
7
+
8
+ def test_invalid_theme():
9
+ """Check that an invalid theme name raises an error"""
10
+ with pytest.raises(KeyError):
11
+ mt.set_theme("invalid key")
12
+
13
+
14
+ def test_valid_themes():
15
+ """Check that all valid theme names don't raise an error"""
16
+ for theme in mt.ALL_THEMES.keys():
17
+ assert "name" in mt.ALL_THEMES[theme].keys()
18
+ assert "author" in mt.ALL_THEMES[theme].keys()
19
+ assert "theme" in mt.ALL_THEMES[theme].keys()
20
+ assert "description" in mt.ALL_THEMES[theme].keys()
21
+ assert len(mt.ALL_THEMES[theme]["description"]) < 200, (
22
+ f"The description of theme {theme} has too many characters. "
23
+ f"It must be below 200, not {len(mt.ALL_THEMES[theme]['description'])}"
24
+ )
25
+ mt.set_theme(theme)
26
+
27
+
28
+ def test_set_theme_default():
29
+ """Check that resetting the default style actually works"""
30
+ plt.rcParams["lines.linewidth"] = 3.1415
31
+ plt.rcParams["axes.titlesize"] = "medium"
32
+
33
+ mt.set_theme("default")
34
+
35
+ for key, default_value in mpl.rcParamsDefault.items():
36
+ assert plt.rcParams[key] == default_value