myplotlib 1.6.0__tar.gz → 1.8.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.
- {myplotlib-1.6.0 → myplotlib-1.8.0}/.gitignore +10 -1
- {myplotlib-1.6.0 → myplotlib-1.8.0}/LICENSE +1 -1
- {myplotlib-1.6.0 → myplotlib-1.8.0}/PKG-INFO +21 -20
- {myplotlib-1.6.0 → myplotlib-1.8.0}/README.md +16 -15
- myplotlib-1.8.0/myplotlib/__init__.py +189 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/classic.dark.mplstyle +0 -4
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/classic.light.mplstyle +0 -4
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fancy.dark.mplstyle +0 -3
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fancy.light.mplstyle +0 -3
- myplotlib-1.8.0/myplotlib/assets/fonts/P22OperinaPro/License.txt +37 -0
- myplotlib-1.8.0/myplotlib/assets/fonts/P22OperinaPro/P22OperinaPro.ttf +0 -0
- myplotlib-1.8.0/myplotlib/assets/fonts/P22OperinaPro/P22OperinaProPatched.ttf +0 -0
- myplotlib-1.8.0/myplotlib/assets/guttenberg.dark.mplstyle +61 -0
- myplotlib-1.8.0/myplotlib/assets/guttenberg.light.mplstyle +58 -0
- myplotlib-1.8.0/myplotlib/assets/latex.mplstyle +5 -0
- myplotlib-1.8.0/myplotlib/plots.py +931 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/tests.py +53 -44
- {myplotlib-1.6.0 → myplotlib-1.8.0}/previews/README.md +18 -10
- {myplotlib-1.6.0 → myplotlib-1.8.0}/pyproject.toml +7 -11
- myplotlib-1.6.0/.github/workflows/pypi-publish.yml +0 -15
- myplotlib-1.6.0/.taplo.toml +0 -6
- myplotlib-1.6.0/.vscode/extensions.json +0 -8
- myplotlib-1.6.0/.vscode/settings.json +0 -7
- myplotlib-1.6.0/MANIFEST.in +0 -6
- myplotlib-1.6.0/myplotlib/__init__.py +0 -76
- myplotlib-1.6.0/myplotlib/assets/latex.mplstyle +0 -2
- myplotlib-1.6.0/myplotlib/plots.py +0 -500
- myplotlib-1.6.0/previews/classic_dark.png +0 -0
- myplotlib-1.6.0/previews/classic_light.png +0 -0
- myplotlib-1.6.0/previews/export_previews.py +0 -30
- myplotlib-1.6.0/previews/fancy_dark.png +0 -0
- myplotlib-1.6.0/previews/fancy_light.png +0 -0
- myplotlib-1.6.0/previews/latex.png +0 -0
- myplotlib-1.6.0/previews/mono_dark.png +0 -0
- myplotlib-1.6.0/previews/mono_light.png +0 -0
- myplotlib-1.6.0/previews/plain.png +0 -0
- myplotlib-1.6.0/shell.nix +0 -45
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/colormaps/bipolar.csv +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/colormaps/colt.csv +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/colormaps/fire.csv +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/colormaps/idl.csv +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/colormaps/sunrise.csv +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/colormaps/thermal.csv +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/colormaps/vanilla.csv +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/AppleChancery.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-Bold.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-BoldItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-ExtraBold.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-ExtraBoldItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-Italic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-Medium.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-MediumItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-Regular.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-SemiBold.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/EBGaramond/EBGaramond-SemiBoldItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyComplexHeavy.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyComplexHeavyItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyComplexLight.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyComplexLightItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyComplexMedium.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyComplexMediumItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyDuplexHeavy.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyDuplexHeavyItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyDuplexLight.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyDuplexLightItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyDuplexMedium.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheyDuplexMediumItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheySimplexHeavy.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheySimplexHeavyItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheySimplexLight.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheySimplexLightItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheySimplexMedium.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/fonts/Hershey/AVHersheySimplexMediumItalic.ttf +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/mono.dark.mplstyle +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/assets/mono.light.mplstyle +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/tools/__init__.py +0 -0
- {myplotlib-1.6.0 → myplotlib-1.8.0}/myplotlib/tools/lic.py +0 -0
|
@@ -40,6 +40,7 @@ share/python-wheels/
|
|
|
40
40
|
.installed.cfg
|
|
41
41
|
*.egg
|
|
42
42
|
MANIFEST
|
|
43
|
+
temp
|
|
43
44
|
|
|
44
45
|
# PyInstaller
|
|
45
46
|
# Usually these files are written by a python script from a template
|
|
@@ -165,4 +166,12 @@ dmypy.json
|
|
|
165
166
|
.pytype/
|
|
166
167
|
|
|
167
168
|
# Cython debug symbols
|
|
168
|
-
cython_debug/
|
|
169
|
+
cython_debug/
|
|
170
|
+
.direnv
|
|
171
|
+
.envrc
|
|
172
|
+
.claude/
|
|
173
|
+
|
|
174
|
+
dist/
|
|
175
|
+
|
|
176
|
+
# LLM
|
|
177
|
+
.agents
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: myplotlib
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: `matplotlib` binder with custom styles and routines for fast plotting
|
|
5
5
|
Project-URL: Repository, https://github.com/haykh/myplotlib
|
|
6
6
|
Author-email: Hayk <haykh.astro@gmail.com>
|
|
7
7
|
Maintainer-email: Hayk <haykh.astro@gmail.com>
|
|
8
8
|
License: BSD 3-Clause License
|
|
9
9
|
|
|
10
|
-
Copyright (c)
|
|
10
|
+
Copyright (c) 2026, Hayk Hakobyan
|
|
11
11
|
|
|
12
12
|
Redistribution and use in source and binary forms, with or without
|
|
13
13
|
modification, are permitted provided that the following conditions are met:
|
|
@@ -40,13 +40,13 @@ Classifier: Intended Audience :: Education
|
|
|
40
40
|
Classifier: Intended Audience :: Science/Research
|
|
41
41
|
Classifier: License :: OSI Approved :: BSD License
|
|
42
42
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
43
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
44
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
45
43
|
Classifier: Programming Language :: Python :: 3.10
|
|
46
44
|
Classifier: Programming Language :: Python :: 3.11
|
|
47
45
|
Classifier: Programming Language :: Python :: 3.12
|
|
46
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
47
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
48
48
|
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
49
|
-
Requires-Python: >=3.
|
|
49
|
+
Requires-Python: >=3.10
|
|
50
50
|
Requires-Dist: matplotlib>=3.5.0
|
|
51
51
|
Requires-Dist: numba>=0.57.0
|
|
52
52
|
Requires-Dist: numpy
|
|
@@ -67,14 +67,17 @@ pip install myplotlib
|
|
|
67
67
|
### loading style, fonts & colormaps
|
|
68
68
|
|
|
69
69
|
```python
|
|
70
|
-
import myplotlib
|
|
71
70
|
import matplotlib.pyplot as plt
|
|
71
|
+
from myplotlib import register
|
|
72
|
+
|
|
73
|
+
register()
|
|
72
74
|
|
|
73
75
|
plt.style.use(STYLE)
|
|
74
76
|
# STYLE can be:
|
|
75
77
|
# - fancy.dark, fancy.light
|
|
76
78
|
# - classic.dark, classic.light
|
|
77
79
|
# - mono.dark, mono.light
|
|
80
|
+
# - guttenberg.dark, guttenberg.light
|
|
78
81
|
# - latex
|
|
79
82
|
|
|
80
83
|
# you may also combine the styles:
|
|
@@ -85,6 +88,8 @@ with plt.style.context(STYLE):
|
|
|
85
88
|
plt.plot(...)
|
|
86
89
|
```
|
|
87
90
|
|
|
91
|
+
> `register()` loads the bundled styles, fonts, and colormaps into Matplotlib. importing `myplotlib` still registers them for backward compatibility, but the explicit call keeps linters from flagging an unused side-effect import.
|
|
92
|
+
|
|
88
93
|
### auxiliary plotting functions
|
|
89
94
|
|
|
90
95
|
```python
|
|
@@ -101,6 +106,16 @@ import myplotlib.tests as mypltest
|
|
|
101
106
|
mypltest?
|
|
102
107
|
```
|
|
103
108
|
|
|
109
|
+
the `guttenberg` styles mimic renaissance-era book illustrations: old-style lettering (P22 Operina Pro, with EB Garamond as fallback for missing glyphs), imperfect hand-drawn lines, and a single-ink line cycle. they pair well with `myplt.hatchedCircle`, which shades circles with engraving-style hatching (optionally only the crescent shadow, as on old drawings of moon phases):
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
with plt.style.context("guttenberg.light"):
|
|
113
|
+
fig, ax = plt.subplots()
|
|
114
|
+
ax.set_aspect("equal")
|
|
115
|
+
myplt.hatchedCircle(ax, (0, 0), 1, angle=45, spacing=0.15)
|
|
116
|
+
myplt.hatchedCircle(ax, (2.5, 0), 1, shade_from=0, shade_depth=0.8)
|
|
117
|
+
```
|
|
118
|
+
|
|
104
119
|
for more usage examples checkout the `tests/` submodule.
|
|
105
120
|
|
|
106
121
|
## requirements
|
|
@@ -110,20 +125,6 @@ for more usage examples checkout the `tests/` submodule.
|
|
|
110
125
|
* `latex` (used for `fancy` and `latex` only)
|
|
111
126
|
* `numba>=0.57.0`
|
|
112
127
|
|
|
113
|
-
## development
|
|
114
|
-
|
|
115
|
-
when deploying a new version, there are three necessary steps to take.
|
|
116
|
-
|
|
117
|
-
1. increase the version string in `myplotlib/__init__.py`.
|
|
118
|
-
2. generate the previews:
|
|
119
|
-
```sh
|
|
120
|
-
python3 previews/export_previews.py
|
|
121
|
-
```
|
|
122
|
-
3. build the new tarballs in the `dist` directory:
|
|
123
|
-
```sh
|
|
124
|
-
python -m build --sdist --outdir dist .
|
|
125
|
-
```
|
|
126
|
-
|
|
127
128
|
## To-do
|
|
128
129
|
|
|
129
130
|
- [ ] isocontour plotting
|
|
@@ -13,14 +13,17 @@ pip install myplotlib
|
|
|
13
13
|
### loading style, fonts & colormaps
|
|
14
14
|
|
|
15
15
|
```python
|
|
16
|
-
import myplotlib
|
|
17
16
|
import matplotlib.pyplot as plt
|
|
17
|
+
from myplotlib import register
|
|
18
|
+
|
|
19
|
+
register()
|
|
18
20
|
|
|
19
21
|
plt.style.use(STYLE)
|
|
20
22
|
# STYLE can be:
|
|
21
23
|
# - fancy.dark, fancy.light
|
|
22
24
|
# - classic.dark, classic.light
|
|
23
25
|
# - mono.dark, mono.light
|
|
26
|
+
# - guttenberg.dark, guttenberg.light
|
|
24
27
|
# - latex
|
|
25
28
|
|
|
26
29
|
# you may also combine the styles:
|
|
@@ -31,6 +34,8 @@ with plt.style.context(STYLE):
|
|
|
31
34
|
plt.plot(...)
|
|
32
35
|
```
|
|
33
36
|
|
|
37
|
+
> `register()` loads the bundled styles, fonts, and colormaps into Matplotlib. importing `myplotlib` still registers them for backward compatibility, but the explicit call keeps linters from flagging an unused side-effect import.
|
|
38
|
+
|
|
34
39
|
### auxiliary plotting functions
|
|
35
40
|
|
|
36
41
|
```python
|
|
@@ -47,6 +52,16 @@ import myplotlib.tests as mypltest
|
|
|
47
52
|
mypltest?
|
|
48
53
|
```
|
|
49
54
|
|
|
55
|
+
the `guttenberg` styles mimic renaissance-era book illustrations: old-style lettering (P22 Operina Pro, with EB Garamond as fallback for missing glyphs), imperfect hand-drawn lines, and a single-ink line cycle. they pair well with `myplt.hatchedCircle`, which shades circles with engraving-style hatching (optionally only the crescent shadow, as on old drawings of moon phases):
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
with plt.style.context("guttenberg.light"):
|
|
59
|
+
fig, ax = plt.subplots()
|
|
60
|
+
ax.set_aspect("equal")
|
|
61
|
+
myplt.hatchedCircle(ax, (0, 0), 1, angle=45, spacing=0.15)
|
|
62
|
+
myplt.hatchedCircle(ax, (2.5, 0), 1, shade_from=0, shade_depth=0.8)
|
|
63
|
+
```
|
|
64
|
+
|
|
50
65
|
for more usage examples checkout the `tests/` submodule.
|
|
51
66
|
|
|
52
67
|
## requirements
|
|
@@ -56,20 +71,6 @@ for more usage examples checkout the `tests/` submodule.
|
|
|
56
71
|
* `latex` (used for `fancy` and `latex` only)
|
|
57
72
|
* `numba>=0.57.0`
|
|
58
73
|
|
|
59
|
-
## development
|
|
60
|
-
|
|
61
|
-
when deploying a new version, there are three necessary steps to take.
|
|
62
|
-
|
|
63
|
-
1. increase the version string in `myplotlib/__init__.py`.
|
|
64
|
-
2. generate the previews:
|
|
65
|
-
```sh
|
|
66
|
-
python3 previews/export_previews.py
|
|
67
|
-
```
|
|
68
|
-
3. build the new tarballs in the `dist` directory:
|
|
69
|
-
```sh
|
|
70
|
-
python -m build --sdist --outdir dist .
|
|
71
|
-
```
|
|
72
|
-
|
|
73
74
|
## To-do
|
|
74
75
|
|
|
75
76
|
- [ ] isocontour plotting
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"""Register bundled Matplotlib styles, colormaps, and fonts.
|
|
2
|
+
|
|
3
|
+
Importing `myplotlib` adds package assets to Matplotlib's style library,
|
|
4
|
+
colormap registry, and font manager.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "1.8.0"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import warnings
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Literal, Sequence, cast
|
|
13
|
+
import matplotlib.pyplot as plt
|
|
14
|
+
from matplotlib import font_manager, rc_params_from_file
|
|
15
|
+
import matplotlib.colors as mcolors
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def __RGBToPyCmap(rgbdata):
|
|
19
|
+
"""Convert RGB samples into a Matplotlib segmented colormap dictionary.
|
|
20
|
+
|
|
21
|
+
Args
|
|
22
|
+
----
|
|
23
|
+
rgbdata : NDArray
|
|
24
|
+
Array of RGB samples with shape `(n, 3)` and values on `[0, 1]`.
|
|
25
|
+
|
|
26
|
+
Returns
|
|
27
|
+
-------
|
|
28
|
+
dict[Literal['red', 'green', 'blue', 'alpha'], Sequence[tuple[float, ...]]]
|
|
29
|
+
Segmented colormap channel data accepted by `LinearSegmentedColormap`.
|
|
30
|
+
"""
|
|
31
|
+
import numpy as np
|
|
32
|
+
|
|
33
|
+
nsteps = rgbdata.shape[0]
|
|
34
|
+
stepaxis = np.linspace(0, 1, nsteps)
|
|
35
|
+
rdata = []
|
|
36
|
+
gdata = []
|
|
37
|
+
bdata = []
|
|
38
|
+
for istep in range(nsteps):
|
|
39
|
+
r = rgbdata[istep, 0]
|
|
40
|
+
g = rgbdata[istep, 1]
|
|
41
|
+
b = rgbdata[istep, 2]
|
|
42
|
+
rdata.append((stepaxis[istep], r, r))
|
|
43
|
+
gdata.append((stepaxis[istep], g, g))
|
|
44
|
+
bdata.append((stepaxis[istep], b, b))
|
|
45
|
+
mpl_data = {
|
|
46
|
+
"red": rdata,
|
|
47
|
+
"green": gdata,
|
|
48
|
+
"blue": bdata,
|
|
49
|
+
}
|
|
50
|
+
return cast(
|
|
51
|
+
dict[
|
|
52
|
+
Literal["red", "green", "blue", "alpha"],
|
|
53
|
+
Sequence[tuple[float, ...]],
|
|
54
|
+
],
|
|
55
|
+
mpl_data,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
CUSTOM_CMAPS = []
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def __InstallCmapFromCSV(csv):
|
|
63
|
+
"""Register a CSV colormap and its reversed variant.
|
|
64
|
+
|
|
65
|
+
Args
|
|
66
|
+
----
|
|
67
|
+
csv : str | Path
|
|
68
|
+
Path to a comma-separated RGB colormap file.
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
-------
|
|
72
|
+
None
|
|
73
|
+
The colormap is registered with Matplotlib in place.
|
|
74
|
+
"""
|
|
75
|
+
global CUSTOM_CMAPS
|
|
76
|
+
import os
|
|
77
|
+
import numpy as np
|
|
78
|
+
import matplotlib as mpl
|
|
79
|
+
|
|
80
|
+
cmap = os.path.splitext(os.path.basename(csv))[0]
|
|
81
|
+
if cmap not in CUSTOM_CMAPS:
|
|
82
|
+
CUSTOM_CMAPS.append(cmap)
|
|
83
|
+
cmap_data = np.loadtxt(csv, delimiter=",")
|
|
84
|
+
if cmap not in mpl.colormaps.keys():
|
|
85
|
+
mpl_data = __RGBToPyCmap(cmap_data)
|
|
86
|
+
mpl.colormaps.register(
|
|
87
|
+
cmap=mcolors.LinearSegmentedColormap(cmap, mpl_data, cmap_data.shape[0])
|
|
88
|
+
)
|
|
89
|
+
cmap = f"{cmap}_r"
|
|
90
|
+
if cmap not in mpl.colormaps.keys():
|
|
91
|
+
mpl_data_r = __RGBToPyCmap(cmap_data[::-1, :])
|
|
92
|
+
mpl.colormaps.register(
|
|
93
|
+
cmap=mcolors.LinearSegmentedColormap(cmap, mpl_data_r, cmap_data.shape[0])
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def __RegisterStyles(styles_path):
|
|
98
|
+
"""Register bundled Matplotlib style files.
|
|
99
|
+
|
|
100
|
+
Args
|
|
101
|
+
----
|
|
102
|
+
styles_path : str | Path
|
|
103
|
+
Directory containing `.mplstyle` files.
|
|
104
|
+
|
|
105
|
+
Returns
|
|
106
|
+
-------
|
|
107
|
+
None
|
|
108
|
+
Style files are registered in Matplotlib in place.
|
|
109
|
+
"""
|
|
110
|
+
for path in Path(styles_path).rglob("*.mplstyle"):
|
|
111
|
+
with warnings.catch_warnings(record=True):
|
|
112
|
+
plt.style.library[path.stem] = rc_params_from_file(
|
|
113
|
+
path, use_default_template=False
|
|
114
|
+
)
|
|
115
|
+
plt.style.available[:] = sorted(
|
|
116
|
+
name for name in plt.style.library if not name.startswith("_")
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def __RegisterColormaps(cmap_dir):
|
|
121
|
+
"""Register bundled CSV colormaps.
|
|
122
|
+
|
|
123
|
+
Args
|
|
124
|
+
----
|
|
125
|
+
cmap_dir : str | Path
|
|
126
|
+
Directory containing CSV colormap files.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
list[str]
|
|
131
|
+
Names of colormap files found in `cmap_dir`.
|
|
132
|
+
"""
|
|
133
|
+
cmap_paths = [path for path in sorted(Path(cmap_dir).iterdir()) if path.is_file()]
|
|
134
|
+
for path in cmap_paths:
|
|
135
|
+
__InstallCmapFromCSV(path)
|
|
136
|
+
return [path.name for path in cmap_paths]
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def __RegisterFonts(font_dir):
|
|
140
|
+
"""Register bundled font files.
|
|
141
|
+
|
|
142
|
+
Args
|
|
143
|
+
----
|
|
144
|
+
font_dir : str | Path
|
|
145
|
+
Directory containing font files.
|
|
146
|
+
|
|
147
|
+
Returns
|
|
148
|
+
-------
|
|
149
|
+
list[str]
|
|
150
|
+
Font files found by Matplotlib and registered with its font manager.
|
|
151
|
+
"""
|
|
152
|
+
font_files = font_manager.findSystemFonts(fontpaths=[str(font_dir)])
|
|
153
|
+
for font_file in font_files:
|
|
154
|
+
font_manager.fontManager.addfont(font_file)
|
|
155
|
+
return font_files
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
myplotlib_path = str(Path(__file__).resolve().parent)
|
|
159
|
+
styles_path = str(Path(myplotlib_path) / "assets")
|
|
160
|
+
|
|
161
|
+
CMAP_DIR = str(Path(myplotlib_path) / "assets" / "colormaps")
|
|
162
|
+
CMAPS = []
|
|
163
|
+
|
|
164
|
+
FONT_DIR = str(Path(myplotlib_path) / "assets" / "fonts")
|
|
165
|
+
font_files = []
|
|
166
|
+
|
|
167
|
+
_ASSETS_REGISTERED = False
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def register():
|
|
171
|
+
"""Register bundled Matplotlib assets.
|
|
172
|
+
|
|
173
|
+
Returns
|
|
174
|
+
-------
|
|
175
|
+
None
|
|
176
|
+
Styles, colormaps, and fonts are registered with Matplotlib in place.
|
|
177
|
+
"""
|
|
178
|
+
global CMAPS, font_files, _ASSETS_REGISTERED
|
|
179
|
+
|
|
180
|
+
if _ASSETS_REGISTERED:
|
|
181
|
+
return
|
|
182
|
+
|
|
183
|
+
__RegisterStyles(styles_path)
|
|
184
|
+
CMAPS = __RegisterColormaps(CMAP_DIR)
|
|
185
|
+
font_files = __RegisterFonts(FONT_DIR)
|
|
186
|
+
_ASSETS_REGISTERED = True
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
register()
|
|
@@ -26,9 +26,6 @@ legend.frameon: False
|
|
|
26
26
|
savefig.bbox: tight
|
|
27
27
|
savefig.pad_inches: 0.05
|
|
28
28
|
|
|
29
|
-
#axes.labelweight : normal
|
|
30
|
-
axes.labelsize: 16
|
|
31
|
-
|
|
32
29
|
grid.alpha: 0.2
|
|
33
30
|
|
|
34
31
|
# tex
|
|
@@ -36,7 +33,6 @@ text.usetex: False
|
|
|
36
33
|
|
|
37
34
|
# fonts
|
|
38
35
|
font.weight: 500
|
|
39
|
-
font.size: 16
|
|
40
36
|
|
|
41
37
|
font.serif: AVHershey Complex
|
|
42
38
|
font.sans-serif: AVHershey Duplex
|
|
@@ -26,9 +26,6 @@ legend.frameon: False
|
|
|
26
26
|
savefig.bbox: tight
|
|
27
27
|
savefig.pad_inches: 0.05
|
|
28
28
|
|
|
29
|
-
#axes.labelweight : normal
|
|
30
|
-
axes.labelsize: 14
|
|
31
|
-
|
|
32
29
|
grid.alpha: 0.2
|
|
33
30
|
|
|
34
31
|
# tex
|
|
@@ -36,7 +33,6 @@ text.usetex: False
|
|
|
36
33
|
|
|
37
34
|
# fonts
|
|
38
35
|
font.weight: 500
|
|
39
|
-
font.size: 16
|
|
40
36
|
|
|
41
37
|
font.serif: AVHershey Complex
|
|
42
38
|
font.sans-serif: AVHershey Duplex
|
|
@@ -8,14 +8,11 @@ xtick.direction: out
|
|
|
8
8
|
ytick.direction: out
|
|
9
9
|
grid.alpha: 0.2
|
|
10
10
|
|
|
11
|
-
axes.labelsize: 16
|
|
12
|
-
|
|
13
11
|
# tex
|
|
14
12
|
text.usetex: True
|
|
15
13
|
text.latex.preamble: \usepackage{amsmath,bm,xcolor,ebgaramond-maths}
|
|
16
14
|
|
|
17
15
|
#fonts
|
|
18
|
-
font.size: 14
|
|
19
16
|
|
|
20
17
|
font.serif: EB Garamond
|
|
21
18
|
font.sans-serif: EB Garamond
|
|
@@ -7,14 +7,11 @@ xtick.direction: out
|
|
|
7
7
|
ytick.direction: out
|
|
8
8
|
grid.alpha: 0.2
|
|
9
9
|
|
|
10
|
-
axes.labelsize: 16
|
|
11
|
-
|
|
12
10
|
# tex
|
|
13
11
|
text.usetex: True
|
|
14
12
|
text.latex.preamble: \usepackage{amsmath,bm,xcolor,ebgaramond-maths}
|
|
15
13
|
|
|
16
14
|
#fonts
|
|
17
|
-
font.size: 14
|
|
18
15
|
|
|
19
16
|
font.serif: EB Garamond
|
|
20
17
|
font.sans-serif: EB Garamond
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
-------------------------------------------------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
FREE FONTS : http://www.OnlineWebFonts.Com
|
|
6
|
+
|
|
7
|
+
-------------------------------------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
You must credit the author
|
|
10
|
+
Copy this link on your web
|
|
11
|
+
|
|
12
|
+
<div>Fonts made from <a href="http://www.onlinewebfonts.com">Web Fonts</a> is licensed by CC BY 4.0</div>
|
|
13
|
+
|
|
14
|
+
OR
|
|
15
|
+
|
|
16
|
+
<a href="http://www.onlinewebfonts.com">Web Fonts</a>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
=======================================================================================================
|
|
20
|
+
|
|
21
|
+
OnlineWebFonts.Com features an amazing collection of free fonts,
|
|
22
|
+
premium fonts and free dingbats. With over 8,000,00 freeware fonts,
|
|
23
|
+
you've come to the best place to download fonts!
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
=======================================================================================================
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
OnlineWebFonts.Com Some fonts provided are trial versions of full versions and may not allow embedding
|
|
30
|
+
unless a commercial license is purchased or may contain a limited character set.
|
|
31
|
+
Please review any files included with your download,
|
|
32
|
+
which will usually include information on the usage and licenses of the fonts.
|
|
33
|
+
If no information is provided,
|
|
34
|
+
please use at your own discretion or contact the author directly.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
=======================================================================================================
|
|
Binary file
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# guttenberg.dark: renaissance-era book illustration style
|
|
2
|
+
# pale ink on dark paper, imperfect hand-drawn lines, old-style lettering
|
|
3
|
+
|
|
4
|
+
# ink & paper
|
|
5
|
+
figure.facecolor: 14100c
|
|
6
|
+
axes.facecolor: 14100c
|
|
7
|
+
savefig.facecolor: 14100c
|
|
8
|
+
text.color: e8e1d2
|
|
9
|
+
axes.edgecolor: e8e1d2
|
|
10
|
+
axes.labelcolor: e8e1d2
|
|
11
|
+
xtick.color: e8e1d2
|
|
12
|
+
ytick.color: e8e1d2
|
|
13
|
+
|
|
14
|
+
# single-ink cycle: fresh & faded ink, then engraving line styles
|
|
15
|
+
axes.prop_cycle: cycler('linestyle', ['-', '--', ':', '-.']) * cycler('color', ['e8e1d2', '8d8477'])
|
|
16
|
+
|
|
17
|
+
# the hand of the engraver: (scale, length, randomness)
|
|
18
|
+
path.sketch: (1.5, 200, 2)
|
|
19
|
+
|
|
20
|
+
lines.linewidth: 1.4
|
|
21
|
+
lines.solid_capstyle: round
|
|
22
|
+
lines.dash_capstyle: round
|
|
23
|
+
|
|
24
|
+
axes.linewidth: 1.0
|
|
25
|
+
axes.grid: False
|
|
26
|
+
axes.axisbelow: True
|
|
27
|
+
axes.spines.top: False
|
|
28
|
+
axes.spines.right: False
|
|
29
|
+
axes.unicode_minus: False
|
|
30
|
+
|
|
31
|
+
xtick.direction: out
|
|
32
|
+
ytick.direction: out
|
|
33
|
+
|
|
34
|
+
legend.frameon: False
|
|
35
|
+
|
|
36
|
+
# continuous tone rendered as ink wash
|
|
37
|
+
image.cmap: binary_r
|
|
38
|
+
|
|
39
|
+
# fonts: p22 operina pro throughout, eb garamond as per-glyph fallback
|
|
40
|
+
# note: the concrete family list must be in font.family itself -- a generic alias
|
|
41
|
+
# (e.g. `serif`) resolves to a single font and disables the per-glyph fallback
|
|
42
|
+
text.usetex: False
|
|
43
|
+
font.family: P22OperinaProPatched, EB Garamond
|
|
44
|
+
font.style: normal
|
|
45
|
+
font.weight: normal
|
|
46
|
+
font.serif: P22OperinaProPatched, EB Garamond
|
|
47
|
+
font.sans-serif: P22OperinaProPatched, EB Garamond
|
|
48
|
+
font.monospace: P22OperinaProPatched, EB Garamond
|
|
49
|
+
axes.titleweight: normal
|
|
50
|
+
figure.titleweight: normal
|
|
51
|
+
|
|
52
|
+
# mathtext does not support eb garamond as a custom per-glyph fallback
|
|
53
|
+
mathtext.fontset: custom
|
|
54
|
+
mathtext.fallback: None
|
|
55
|
+
mathtext.default: it
|
|
56
|
+
mathtext.rm: P22OperinaProPatched:style=normal:weight=normal
|
|
57
|
+
mathtext.it: P22OperinaProPatched:style=normal:weight=normal
|
|
58
|
+
mathtext.bf: P22OperinaProPatched:style=normal:weight=normal
|
|
59
|
+
mathtext.sf: P22OperinaProPatched:style=normal:weight=normal
|
|
60
|
+
mathtext.tt: P22OperinaProPatched:style=normal:weight=normal
|
|
61
|
+
mathtext.cal: P22OperinaProPatched:style=normal:weight=normal
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# guttenberg.light: renaissance-era book illustration style
|
|
2
|
+
# black ink on paper, imperfect hand-drawn lines, old-style lettering
|
|
3
|
+
|
|
4
|
+
# ink & paper
|
|
5
|
+
figure.facecolor: ffffff
|
|
6
|
+
axes.facecolor: ffffff
|
|
7
|
+
savefig.facecolor: ffffff
|
|
8
|
+
text.color: 191411
|
|
9
|
+
axes.edgecolor: 191411
|
|
10
|
+
axes.labelcolor: 191411
|
|
11
|
+
xtick.color: 191411
|
|
12
|
+
ytick.color: 191411
|
|
13
|
+
|
|
14
|
+
# single-ink cycle: fresh & faded ink, then engraving line styles
|
|
15
|
+
axes.prop_cycle: cycler('linestyle', ['-', '--', ':', '-.']) * cycler('color', ['191411', '6f645a'])
|
|
16
|
+
|
|
17
|
+
# the hand of the engraver: (scale, length, randomness)
|
|
18
|
+
path.sketch: (1.5, 200, 2)
|
|
19
|
+
|
|
20
|
+
lines.linewidth: 1.4
|
|
21
|
+
lines.solid_capstyle: round
|
|
22
|
+
lines.dash_capstyle: round
|
|
23
|
+
|
|
24
|
+
axes.linewidth: 1.0
|
|
25
|
+
axes.grid: False
|
|
26
|
+
axes.axisbelow: True
|
|
27
|
+
axes.spines.top: False
|
|
28
|
+
axes.spines.right: False
|
|
29
|
+
axes.unicode_minus: False
|
|
30
|
+
|
|
31
|
+
xtick.direction: out
|
|
32
|
+
ytick.direction: out
|
|
33
|
+
|
|
34
|
+
legend.frameon: False
|
|
35
|
+
|
|
36
|
+
# continuous tone rendered as ink wash
|
|
37
|
+
image.cmap: binary
|
|
38
|
+
|
|
39
|
+
text.usetex: False
|
|
40
|
+
font.family: P22OperinaProPatched, EB Garamond
|
|
41
|
+
font.style: normal
|
|
42
|
+
font.weight: normal
|
|
43
|
+
font.serif: P22OperinaProPatched, EB Garamond
|
|
44
|
+
font.sans-serif: P22OperinaProPatched, EB Garamond
|
|
45
|
+
font.monospace: P22OperinaProPatched, EB Garamond
|
|
46
|
+
axes.titleweight: normal
|
|
47
|
+
figure.titleweight: normal
|
|
48
|
+
|
|
49
|
+
# mathtext does not support eb garamond as a custom per-glyph fallback
|
|
50
|
+
mathtext.fontset: custom
|
|
51
|
+
mathtext.fallback: None
|
|
52
|
+
mathtext.default: it
|
|
53
|
+
mathtext.rm: P22OperinaProPatched:style=normal:weight=normal
|
|
54
|
+
mathtext.it: P22OperinaProPatched:style=normal:weight=normal
|
|
55
|
+
mathtext.bf: P22OperinaProPatched:style=normal:weight=normal
|
|
56
|
+
mathtext.sf: P22OperinaProPatched:style=normal:weight=normal
|
|
57
|
+
mathtext.tt: P22OperinaProPatched:style=normal:weight=normal
|
|
58
|
+
mathtext.cal: P22OperinaProPatched:style=normal:weight=normal
|