myplotlib 1.7.0__py3-none-any.whl
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/__init__.py +79 -0
- myplotlib/assets/classic.dark.mplstyle +69 -0
- myplotlib/assets/classic.light.mplstyle +60 -0
- myplotlib/assets/colormaps/bipolar.csv +1023 -0
- myplotlib/assets/colormaps/colt.csv +1024 -0
- myplotlib/assets/colormaps/fire.csv +256 -0
- myplotlib/assets/colormaps/idl.csv +256 -0
- myplotlib/assets/colormaps/sunrise.csv +512 -0
- myplotlib/assets/colormaps/thermal.csv +512 -0
- myplotlib/assets/colormaps/vanilla.csv +512 -0
- myplotlib/assets/fancy.dark.mplstyle +43 -0
- myplotlib/assets/fancy.light.mplstyle +32 -0
- myplotlib/assets/fonts/AppleChancery.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-Bold.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-BoldItalic.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-ExtraBold.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-ExtraBoldItalic.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-Italic.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-Medium.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-MediumItalic.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-Regular.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-SemiBold.ttf +0 -0
- myplotlib/assets/fonts/EBGaramond/EBGaramond-SemiBoldItalic.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyComplexHeavy.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyComplexHeavyItalic.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyComplexLight.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyComplexLightItalic.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyComplexMedium.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyComplexMediumItalic.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyDuplexHeavy.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyDuplexHeavyItalic.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyDuplexLight.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyDuplexLightItalic.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyDuplexMedium.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheyDuplexMediumItalic.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheySimplexHeavy.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheySimplexHeavyItalic.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheySimplexLight.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheySimplexLightItalic.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheySimplexMedium.ttf +0 -0
- myplotlib/assets/fonts/Hershey/AVHersheySimplexMediumItalic.ttf +0 -0
- myplotlib/assets/latex.mplstyle +2 -0
- myplotlib/assets/mono.dark.mplstyle +21 -0
- myplotlib/assets/mono.light.mplstyle +11 -0
- myplotlib/plots.py +658 -0
- myplotlib/tests.py +246 -0
- myplotlib/tools/__init__.py +0 -0
- myplotlib/tools/lic.py +99 -0
- myplotlib-1.7.0.dist-info/METADATA +137 -0
- myplotlib-1.7.0.dist-info/RECORD +52 -0
- myplotlib-1.7.0.dist-info/WHEEL +4 -0
- myplotlib-1.7.0.dist-info/licenses/LICENSE +28 -0
myplotlib/tests.py
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"""
|
|
2
|
+
`myplotlib.tests`
|
|
3
|
+
|
|
4
|
+
commands to help preview the custom styles (function names are self-descriptive). available functions are:
|
|
5
|
+
|
|
6
|
+
* testColormaps
|
|
7
|
+
* testColors
|
|
8
|
+
* testScatter
|
|
9
|
+
* testPlot
|
|
10
|
+
* testErrorbar
|
|
11
|
+
* testPlot2d
|
|
12
|
+
* testVectorPlot2d
|
|
13
|
+
|
|
14
|
+
* testAll
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import myplotlib.plots as myplt
|
|
18
|
+
import myplotlib
|
|
19
|
+
|
|
20
|
+
import matplotlib
|
|
21
|
+
import matplotlib.colors as mcolors
|
|
22
|
+
import matplotlib.pyplot as plt
|
|
23
|
+
import numpy as np
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def __getAx(ax):
|
|
27
|
+
if ax is None:
|
|
28
|
+
fig, ax = plt.subplots()
|
|
29
|
+
return ax
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def testColormaps(ax=None):
|
|
33
|
+
ax = __getAx(ax)
|
|
34
|
+
zz = [np.linspace(0, 1, 256)]
|
|
35
|
+
pad = 0.3
|
|
36
|
+
dy = (1 - pad) / (len(myplotlib.CUSTOM_CMAPS))
|
|
37
|
+
pady = pad / (len(myplotlib.CUSTOM_CMAPS))
|
|
38
|
+
for i, cm in enumerate(myplotlib.CUSTOM_CMAPS):
|
|
39
|
+
y1, y2 = (pady * (i + 0.5) + dy * i, pady * (i + 0.5) + dy * (i + 1))
|
|
40
|
+
ax.imshow(zz, extent=(0, 1, y1, y2), cmap=cm)
|
|
41
|
+
if matplotlib.rcParams["text.usetex"]:
|
|
42
|
+
name = r"$\texttt{{`{}'}}$".format(cm)
|
|
43
|
+
else:
|
|
44
|
+
name = f"'{cm}'"
|
|
45
|
+
ax.text(1.04, 0.5 * (y1 + y2), name, va="center", ha="left")
|
|
46
|
+
ax.set_ylim(0, 1)
|
|
47
|
+
ax.axis("off")
|
|
48
|
+
ax.set_title("extra colormaps")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def testColors(ax=None):
|
|
52
|
+
ax = __getAx(ax)
|
|
53
|
+
prop_cycle = plt.rcParams["axes.prop_cycle"]
|
|
54
|
+
colors = prop_cycle.by_key()["color"]
|
|
55
|
+
title = "default color cycle"
|
|
56
|
+
ax.set_title(title)
|
|
57
|
+
for j, c in enumerate(colors):
|
|
58
|
+
v_offset = -(j / len(colors))
|
|
59
|
+
th = np.linspace(0, 2 * np.pi, 512)
|
|
60
|
+
ax.plot(th, 0.1 * np.sin(th) + v_offset, color=c, lw=2)
|
|
61
|
+
if matplotlib.rcParams["text.usetex"]:
|
|
62
|
+
name = r"$\texttt{{`C{}'}}$".format(j)
|
|
63
|
+
else:
|
|
64
|
+
name = f"`C{j}'"
|
|
65
|
+
ax.annotate(
|
|
66
|
+
name,
|
|
67
|
+
(0, v_offset),
|
|
68
|
+
xytext=(-1.5, 0),
|
|
69
|
+
ha="right",
|
|
70
|
+
va="center",
|
|
71
|
+
color=c,
|
|
72
|
+
textcoords="offset points",
|
|
73
|
+
)
|
|
74
|
+
if matplotlib.rcParams["text.usetex"]:
|
|
75
|
+
name = r"$\texttt{{{}}}$".format(c.replace("#", r"\#"))
|
|
76
|
+
else:
|
|
77
|
+
name = f"{c}"
|
|
78
|
+
ax.annotate(
|
|
79
|
+
name,
|
|
80
|
+
(2 * np.pi, v_offset),
|
|
81
|
+
xytext=(1.5, 0),
|
|
82
|
+
ha="left",
|
|
83
|
+
va="center",
|
|
84
|
+
color=c,
|
|
85
|
+
textcoords="offset points",
|
|
86
|
+
)
|
|
87
|
+
ax.axis("off")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def testScatter(ax=None):
|
|
91
|
+
ax = __getAx(ax)
|
|
92
|
+
myplt.scatter(
|
|
93
|
+
ax,
|
|
94
|
+
np.random.random(100),
|
|
95
|
+
np.random.random(100),
|
|
96
|
+
xlog=True,
|
|
97
|
+
ylog=True,
|
|
98
|
+
s=(0.1 + np.random.random(100)) * 20,
|
|
99
|
+
c="C0",
|
|
100
|
+
label="drunk points",
|
|
101
|
+
marker="*",
|
|
102
|
+
)
|
|
103
|
+
myplt.scatter(
|
|
104
|
+
ax,
|
|
105
|
+
10 ** (np.random.random(100) * 2 - 2),
|
|
106
|
+
10 ** (np.random.random(100) * 2 - 2),
|
|
107
|
+
xlog=True,
|
|
108
|
+
ylog=True,
|
|
109
|
+
s=(0.1 + np.random.random(100)) * 20,
|
|
110
|
+
c="C1",
|
|
111
|
+
label="sober points",
|
|
112
|
+
ylim=(1e-2, None),
|
|
113
|
+
xlim=(1e-2, None),
|
|
114
|
+
)
|
|
115
|
+
# label top left @ outside
|
|
116
|
+
ax.legend(
|
|
117
|
+
loc="upper left",
|
|
118
|
+
bbox_to_anchor=(0, 1.15),
|
|
119
|
+
borderaxespad=0.0,
|
|
120
|
+
ncol=2,
|
|
121
|
+
frameon=False,
|
|
122
|
+
)
|
|
123
|
+
ax.set_xlabel(r"some funny number $x^2/y$ [units]")
|
|
124
|
+
ax.set_ylabel(r"other number $z_{\nu}$ [units]")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def testPlot(ax=None):
|
|
128
|
+
ax = __getAx(ax)
|
|
129
|
+
myplt.plot(
|
|
130
|
+
ax,
|
|
131
|
+
np.arange(100),
|
|
132
|
+
20 * (2 + np.sin(np.linspace(0, 20, 100)) + np.random.random(100) ** 5),
|
|
133
|
+
c="C4",
|
|
134
|
+
ls=":",
|
|
135
|
+
)
|
|
136
|
+
myplt.plot(
|
|
137
|
+
ax,
|
|
138
|
+
np.arange(100),
|
|
139
|
+
20 * (2 + np.sin(np.linspace(0, 20, 100)) + np.random.random(100) ** 5),
|
|
140
|
+
c="C2",
|
|
141
|
+
)
|
|
142
|
+
ax.set_ylabel(r"probability [$\%$]")
|
|
143
|
+
ax.set_xlabel("age [yr]")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def testErrorbar(ax=None):
|
|
147
|
+
ax = __getAx(ax)
|
|
148
|
+
x = np.linspace(0, 1000, 10)
|
|
149
|
+
y = np.sin(x / 100)
|
|
150
|
+
dy = np.random.random(len(x)) * (y + 1.5) / 3
|
|
151
|
+
myplt.dataPlot(
|
|
152
|
+
ax.errorbar,
|
|
153
|
+
ax,
|
|
154
|
+
x,
|
|
155
|
+
y,
|
|
156
|
+
yerr=dy,
|
|
157
|
+
marker="o",
|
|
158
|
+
markeredgecolor=ax.get_facecolor(),
|
|
159
|
+
markerfacecolor="C11",
|
|
160
|
+
markeredgewidth=1.5,
|
|
161
|
+
)
|
|
162
|
+
ax.set_xlabel("time [s]")
|
|
163
|
+
ax.set_ylabel("my very accurately measured variable [ly]")
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def testPlot2d(ax=None):
|
|
167
|
+
ax = __getAx(ax)
|
|
168
|
+
x = np.linspace(-3, 3, 240)
|
|
169
|
+
y = np.linspace(-3, 3, 200)
|
|
170
|
+
xx, yy = np.meshgrid(x, y)
|
|
171
|
+
zz = (xx**2 - np.sin(xx * yy**3)) + 6 * np.exp(-(xx**2 + yy**2) / 0.2)
|
|
172
|
+
myplt.plot2d(ax, x, y, zz, cmap="bipolar", centering="edge")
|
|
173
|
+
ax.set_xlabel("landscape in $x$")
|
|
174
|
+
ax.set_ylabel("landscape in $y$")
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def testVectorPlot2d(ax=None):
|
|
178
|
+
ax = __getAx(ax)
|
|
179
|
+
vortex_spacing = 0.5
|
|
180
|
+
extra_factor = 2.0
|
|
181
|
+
a = np.array([1, 0]) * vortex_spacing
|
|
182
|
+
b = np.array([np.cos(np.pi / 3), np.sin(np.pi / 3)]) * vortex_spacing
|
|
183
|
+
rnv = int(2 * extra_factor / vortex_spacing)
|
|
184
|
+
vortices = [n * a + m * b for n in range(-rnv, rnv) for m in range(-rnv, rnv)]
|
|
185
|
+
vortices = [
|
|
186
|
+
(x, y)
|
|
187
|
+
for (x, y) in vortices
|
|
188
|
+
if -extra_factor < x < extra_factor and -extra_factor < y < extra_factor
|
|
189
|
+
]
|
|
190
|
+
sx, sy = (1000, 1000)
|
|
191
|
+
xs = np.linspace(-1, 1, sx).astype(np.float64)[None, :]
|
|
192
|
+
ys = np.linspace(-1, 1, sy).astype(np.float64)[:, None]
|
|
193
|
+
vectors = np.zeros((sx, sy, 2), dtype=np.float64)
|
|
194
|
+
for x, y in vortices:
|
|
195
|
+
rsq = (xs - x) ** 2 + (ys - y) ** 2
|
|
196
|
+
vectors[..., 0] += (ys - y) / rsq
|
|
197
|
+
vectors[..., 1] += -(xs - x) / rsq
|
|
198
|
+
myplt.plotVectorField(
|
|
199
|
+
ax,
|
|
200
|
+
xs,
|
|
201
|
+
ys,
|
|
202
|
+
vectors[:, :, 0],
|
|
203
|
+
vectors[:, :, 1],
|
|
204
|
+
norm=mcolors.LogNorm(1, 1e2),
|
|
205
|
+
cmap="turbo",
|
|
206
|
+
lic_contrast=1,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def testAll():
|
|
211
|
+
fig = plt.figure(figsize=(12, 16))
|
|
212
|
+
axshape = (4, 2)
|
|
213
|
+
axi = 1
|
|
214
|
+
|
|
215
|
+
ax = plt.subplot(*axshape, axi)
|
|
216
|
+
testColors(ax)
|
|
217
|
+
axi += 1
|
|
218
|
+
|
|
219
|
+
ax = plt.subplot(*axshape, axi)
|
|
220
|
+
testColormaps(ax)
|
|
221
|
+
axi += 1
|
|
222
|
+
|
|
223
|
+
ax = plt.subplot(*axshape, axi)
|
|
224
|
+
testScatter(ax)
|
|
225
|
+
axi += 1
|
|
226
|
+
|
|
227
|
+
ax = plt.subplot(*axshape, axi)
|
|
228
|
+
testPlot(ax)
|
|
229
|
+
axi += 1
|
|
230
|
+
|
|
231
|
+
ax = plt.subplot(*axshape, axi)
|
|
232
|
+
testErrorbar(ax)
|
|
233
|
+
axi += 1
|
|
234
|
+
|
|
235
|
+
ax = plt.subplot(*axshape, axi)
|
|
236
|
+
testPlot2d(ax)
|
|
237
|
+
axi += 1
|
|
238
|
+
|
|
239
|
+
ax = plt.subplot(*axshape, axi)
|
|
240
|
+
testVectorPlot2d(ax)
|
|
241
|
+
axi += 1
|
|
242
|
+
|
|
243
|
+
# ax = plt.subplot(*axshape, axi)
|
|
244
|
+
# axi += 1
|
|
245
|
+
|
|
246
|
+
plt.tight_layout()
|
|
File without changes
|
myplotlib/tools/lic.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# . . . . .
|
|
2
|
+
# Credits to Patrick Crumley (@pcrumley)
|
|
3
|
+
# https://github.com/pcrumley/tristanUtils/blob/master/src/lic_NUMBA.py
|
|
4
|
+
# . . . . .
|
|
5
|
+
|
|
6
|
+
# A NUMBA based implementation of the code found here:
|
|
7
|
+
# https://scipy-cookbook.readthedocs.io/items/LineIntegralConvolution.html
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
from numba import jit
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def generate_kernel(klen):
|
|
14
|
+
kernel = np.sin(np.arange(klen) * np.pi / klen)
|
|
15
|
+
return kernel.astype(np.float64)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def generate_texture(shape, seed=None):
|
|
19
|
+
if seed is not None:
|
|
20
|
+
np.random.seed(seed)
|
|
21
|
+
return np.random.rand(*shape).astype(np.float64)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@jit(nopython=False)
|
|
25
|
+
def advance(vx, vy, xyArr, fxfyArr, w, h):
|
|
26
|
+
if vx >= 0:
|
|
27
|
+
tx = (1 - fxfyArr[1]) / vx
|
|
28
|
+
else:
|
|
29
|
+
tx = -fxfyArr[1] / vx
|
|
30
|
+
if vy >= 0:
|
|
31
|
+
ty = (1 - fxfyArr[0]) / vy
|
|
32
|
+
else:
|
|
33
|
+
ty = -fxfyArr[0] / vy
|
|
34
|
+
if tx < ty:
|
|
35
|
+
if vx >= 0:
|
|
36
|
+
xyArr[1] += 1
|
|
37
|
+
fxfyArr[1] = 0
|
|
38
|
+
else:
|
|
39
|
+
xyArr[1] -= 1
|
|
40
|
+
fxfyArr[1] = 1
|
|
41
|
+
fxfyArr[0] += tx * vy
|
|
42
|
+
else:
|
|
43
|
+
if vy >= 0:
|
|
44
|
+
xyArr[0] += 1
|
|
45
|
+
fxfyArr[0] = 0
|
|
46
|
+
else:
|
|
47
|
+
xyArr[0] -= 1
|
|
48
|
+
fxfyArr[0] = 1
|
|
49
|
+
fxfyArr[1] += ty * vx
|
|
50
|
+
if xyArr[1] >= w:
|
|
51
|
+
xyArr[1] = w - 1 # FIXME: other boundary conditions?
|
|
52
|
+
if xyArr[1] < 0:
|
|
53
|
+
xyArr[1] = 0 # FIXME: other boundary conditions?
|
|
54
|
+
if xyArr[0] < 0:
|
|
55
|
+
xyArr[0] = 0 # FIXME: other boundary conditions?
|
|
56
|
+
if xyArr[0] >= h:
|
|
57
|
+
xyArr[0] = h - 1 # FIXME: other boundary conditions?
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@jit(nopython=True)
|
|
61
|
+
def line_integral_convolution(vx, vy, texture, kernel):
|
|
62
|
+
h = vx.shape[0]
|
|
63
|
+
w = vx.shape[1]
|
|
64
|
+
kernellen = kernel.shape[0]
|
|
65
|
+
if h != vy.shape[0] or w != vy.shape[1]:
|
|
66
|
+
raise ValueError("Vx and Vy must the same shape")
|
|
67
|
+
if h != texture.shape[0] or w != texture.shape[1]:
|
|
68
|
+
raise ValueError("The texture must have the same shape as the vectors")
|
|
69
|
+
result = np.zeros((h, w), dtype=np.float32)
|
|
70
|
+
|
|
71
|
+
xyArr = np.ones(2, dtype=np.int32)
|
|
72
|
+
fxfyArr = np.empty(2, dtype=np.float64)
|
|
73
|
+
for i in range(h):
|
|
74
|
+
for j in range(w):
|
|
75
|
+
xyArr[0] = i
|
|
76
|
+
xyArr[1] = j
|
|
77
|
+
fxfyArr[0] = 0.5
|
|
78
|
+
fxfyArr[1] = 0.5
|
|
79
|
+
|
|
80
|
+
k = kernellen // 2
|
|
81
|
+
result[i, j] += kernel[k] * texture[xyArr[0], xyArr[1]]
|
|
82
|
+
while k < kernellen - 1:
|
|
83
|
+
advance(
|
|
84
|
+
vx[xyArr[0], xyArr[1]], vy[xyArr[0], xyArr[1]], xyArr, fxfyArr, w, h
|
|
85
|
+
)
|
|
86
|
+
k += 1
|
|
87
|
+
result[i, j] += kernel[k] * texture[xyArr[0], xyArr[1]]
|
|
88
|
+
xyArr[0] = i
|
|
89
|
+
xyArr[1] = j
|
|
90
|
+
fxfyArr[0] = 0.5
|
|
91
|
+
fxfyArr[1] = 0.5
|
|
92
|
+
|
|
93
|
+
while k > 0:
|
|
94
|
+
advance(
|
|
95
|
+
vx[xyArr[0], xyArr[1]], vy[xyArr[0], xyArr[1]], xyArr, fxfyArr, w, h
|
|
96
|
+
)
|
|
97
|
+
k -= 1
|
|
98
|
+
result[i, j] += kernel[k] * texture[xyArr[0], xyArr[1]]
|
|
99
|
+
return result
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: myplotlib
|
|
3
|
+
Version: 1.7.0
|
|
4
|
+
Summary: `matplotlib` binder with custom styles and routines for fast plotting
|
|
5
|
+
Project-URL: Repository, https://github.com/haykh/myplotlib
|
|
6
|
+
Author-email: Hayk <haykh.astro@gmail.com>
|
|
7
|
+
Maintainer-email: Hayk <haykh.astro@gmail.com>
|
|
8
|
+
License: BSD 3-Clause License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2024, Hayk Hakobyan
|
|
11
|
+
|
|
12
|
+
Redistribution and use in source and binary forms, with or without
|
|
13
|
+
modification, are permitted provided that the following conditions are met:
|
|
14
|
+
|
|
15
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
16
|
+
list of conditions and the following disclaimer.
|
|
17
|
+
|
|
18
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
19
|
+
this list of conditions and the following disclaimer in the documentation
|
|
20
|
+
and/or other materials provided with the distribution.
|
|
21
|
+
|
|
22
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
23
|
+
contributors may be used to endorse or promote products derived from
|
|
24
|
+
this software without specific prior written permission.
|
|
25
|
+
|
|
26
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
27
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
28
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
29
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
30
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
31
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
32
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
33
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
34
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
35
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
36
|
+
License-File: LICENSE
|
|
37
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
38
|
+
Classifier: Framework :: Matplotlib
|
|
39
|
+
Classifier: Intended Audience :: Education
|
|
40
|
+
Classifier: Intended Audience :: Science/Research
|
|
41
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
42
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
44
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
45
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
46
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
47
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
48
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
49
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
50
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
51
|
+
Requires-Python: >=3.8
|
|
52
|
+
Requires-Dist: matplotlib>=3.5.0
|
|
53
|
+
Requires-Dist: numba>=0.57.0
|
|
54
|
+
Requires-Dist: numpy
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
|
|
57
|
+
# `myplotlib`
|
|
58
|
+
|
|
59
|
+
`matplotlib` binder with custom styles and routines for fast plotting. see [previews of available styles](https://github.com/haykh/myplotlib/tree/master/previews#readme).
|
|
60
|
+
|
|
61
|
+
## installation
|
|
62
|
+
|
|
63
|
+
```shell
|
|
64
|
+
pip install myplotlib
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## usage
|
|
68
|
+
|
|
69
|
+
### loading style, fonts & colormaps
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import myplotlib
|
|
73
|
+
import matplotlib.pyplot as plt
|
|
74
|
+
|
|
75
|
+
plt.style.use(STYLE)
|
|
76
|
+
# STYLE can be:
|
|
77
|
+
# - fancy.dark, fancy.light
|
|
78
|
+
# - classic.dark, classic.light
|
|
79
|
+
# - mono.dark, mono.light
|
|
80
|
+
# - latex
|
|
81
|
+
|
|
82
|
+
# you may also combine the styles:
|
|
83
|
+
plt.style.use([STYLE1, STYLE2])
|
|
84
|
+
|
|
85
|
+
# and you can temporarily load the style:
|
|
86
|
+
with plt.style.context(STYLE):
|
|
87
|
+
plt.plot(...)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### auxiliary plotting functions
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
import myplotlib.plots as myplt
|
|
94
|
+
# type for docstring:
|
|
95
|
+
myplt?
|
|
96
|
+
|
|
97
|
+
# for specific function:
|
|
98
|
+
myplt.plot2d?
|
|
99
|
+
|
|
100
|
+
# preview custom styles with built-in functions
|
|
101
|
+
import myplotlib.tests as mypltest
|
|
102
|
+
# type for docstring:
|
|
103
|
+
mypltest?
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
for more usage examples checkout the `tests/` submodule.
|
|
107
|
+
|
|
108
|
+
## requirements
|
|
109
|
+
|
|
110
|
+
* `python >= 3.8`
|
|
111
|
+
* `matplotlib >= 3.5.0`, `numpy`
|
|
112
|
+
* `latex` (used for `fancy` and `latex` only)
|
|
113
|
+
* `numba>=0.57.0`
|
|
114
|
+
|
|
115
|
+
## development
|
|
116
|
+
|
|
117
|
+
when deploying a new version, there are three necessary steps to take.
|
|
118
|
+
|
|
119
|
+
1. increase the version string in `myplotlib/__init__.py`.
|
|
120
|
+
2. generate the previews:
|
|
121
|
+
```sh
|
|
122
|
+
python3 previews/export_previews.py
|
|
123
|
+
```
|
|
124
|
+
3. build the new tarballs in the `dist` directory:
|
|
125
|
+
```sh
|
|
126
|
+
python -m build --sdist --outdir dist .
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## To-do
|
|
130
|
+
|
|
131
|
+
- [ ] isocontour plotting
|
|
132
|
+
- [x] add streamplot for fieldline plotting
|
|
133
|
+
- [x] print all the newly added colormaps and the default color sequence
|
|
134
|
+
- [x] add a test plot for the demo
|
|
135
|
+
- [x] add image to readme
|
|
136
|
+
- [x] dark mode
|
|
137
|
+
- [x] monotype non-Latex mode
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
myplotlib/__init__.py,sha256=wVrsDTVGS2dTgJ07SlAhD2-X_NMt71ot-UFFCm-nURg,2263
|
|
2
|
+
myplotlib/plots.py,sha256=Yi0fJvb6_2jfPJ31IJMjk8oaDS7likYwM1gLCqiwgqw,23096
|
|
3
|
+
myplotlib/tests.py,sha256=fy3HTtL82_MI8Mfd9FN5rP_7GyHlLqa1Le0GKIAUeiU,6185
|
|
4
|
+
myplotlib/assets/classic.dark.mplstyle,sha256=tvS-xMWpBY5mh1EesW8-XdyAp5DzZvF9QoltEFHAoOg,1334
|
|
5
|
+
myplotlib/assets/classic.light.mplstyle,sha256=HFqAYUFn1oym_AhMGNhsk9gg4YxvMP-ziJP-rCotJWk,1163
|
|
6
|
+
myplotlib/assets/fancy.dark.mplstyle,sha256=WSbAvm55MopkXWqu7EM4dugo4AjK_Wx-kFAMc8qWOJI,892
|
|
7
|
+
myplotlib/assets/fancy.light.mplstyle,sha256=18gN61KW2U4kximMwB1cUS3I7y-aj6J_Tj8sySm0ca0,687
|
|
8
|
+
myplotlib/assets/latex.mplstyle,sha256=vAx2ACTjHY_a2qEDesWcx7HRZUnsJpALApu9aHEtBW8,70
|
|
9
|
+
myplotlib/assets/mono.dark.mplstyle,sha256=5S8864oo5xVxejVYHEGbLLTXKiayVtDI4s7pXsFDMJQ,454
|
|
10
|
+
myplotlib/assets/mono.light.mplstyle,sha256=0F4InfwvADEh3COZkrRv22VimFkXPJWuyt3k1b0zcV8,264
|
|
11
|
+
myplotlib/assets/colormaps/bipolar.csv,sha256=fhrg6yifZzXHL-kRmknMrA8B7EFrCR7m4uvJtofCjPU,76725
|
|
12
|
+
myplotlib/assets/colormaps/colt.csv,sha256=qW1o9AzESSZZF7j-vZdpVZ04HNOKEFhdokT5Sy8YgqI,76800
|
|
13
|
+
myplotlib/assets/colormaps/fire.csv,sha256=t17oMeSiS6qgwa_oq_nIVA8BrhrF1Al9wB3uxGyf9ZI,6679
|
|
14
|
+
myplotlib/assets/colormaps/idl.csv,sha256=G_SXnUCPLSPFn3Wivk8_ahWJb9NaxE2irMWCVfR6fUY,9996
|
|
15
|
+
myplotlib/assets/colormaps/sunrise.csv,sha256=MdP9LVNFs1j2sGCqUfPnimoK5MiVF-uFNW0LsfzfM1Q,38400
|
|
16
|
+
myplotlib/assets/colormaps/thermal.csv,sha256=EgH1d-RX_GyWgAdCyYl6Aoke_cthpGi8wZH7bZnpQZ4,38400
|
|
17
|
+
myplotlib/assets/colormaps/vanilla.csv,sha256=YX-i3rEDGo8QC-ceOM3U6lAiT2Ycil0ROPUh7lfUE7s,38400
|
|
18
|
+
myplotlib/assets/fonts/AppleChancery.ttf,sha256=L3rtZ2T17b-Jw1IOBkXIIR6fsIFH8l6SnmS9R1LBPLs,244278
|
|
19
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-Bold.ttf,sha256=kzL2B8SfxY9DoEI3gBNU6TbkHv6kZqTUX1KEeHsvcBQ,601316
|
|
20
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-BoldItalic.ttf,sha256=6wjf6M2LD8pkck5GvBLiYf4Hdl9guk6LADmSyJeGxcM,567300
|
|
21
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-ExtraBold.ttf,sha256=sQG2LjRv7b65CZ243sQCAou61cMtvSptpoHN9-ojr9o,600940
|
|
22
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-ExtraBoldItalic.ttf,sha256=T2U3wchUn4oujaBGk1NyjcF-1aCrjC9jVXt08v_m-0I,566936
|
|
23
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-Italic.ttf,sha256=Ep2mq5JGY5-pIOQ74a2YIkdN0mRh6_5emTajoguTqvs,564280
|
|
24
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-Medium.ttf,sha256=-y5DwNxe2Cvd25eDgtSZh2dE4UGB8AXYMIYOQCuBcR4,601412
|
|
25
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-MediumItalic.ttf,sha256=w9CnnMc0UcZfZzl3F9CGajylGDt4HC8II-8TD0Af8RE,566872
|
|
26
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-Regular.ttf,sha256=vK62QKPXvkXFoa-IULEIgN5oEMIFQrX6pVyC6yhtRr4,599076
|
|
27
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-SemiBold.ttf,sha256=jc7IqT1lVrzt5gITNSjAhUPSqzsH4Nz-cDQUT8EWHqQ,601652
|
|
28
|
+
myplotlib/assets/fonts/EBGaramond/EBGaramond-SemiBoldItalic.ttf,sha256=QAAK0jzamch-EkuJ7wkWvIC49ycybN8d_l_VkER_Heg,567528
|
|
29
|
+
myplotlib/assets/fonts/Hershey/AVHersheyComplexHeavy.ttf,sha256=AaMvjVZePkM04B8Gk9Ajo7yqBhhkugv_mKY0_-0DmoE,76644
|
|
30
|
+
myplotlib/assets/fonts/Hershey/AVHersheyComplexHeavyItalic.ttf,sha256=VBJfqjC0QCKEKYsHSfhC23pDOgx7ESKiAve3hbIaCkY,69524
|
|
31
|
+
myplotlib/assets/fonts/Hershey/AVHersheyComplexLight.ttf,sha256=v_IWxLLaWQA1yl5TeysKWQRAUa1RH02zDX5Hc8CPqLM,89620
|
|
32
|
+
myplotlib/assets/fonts/Hershey/AVHersheyComplexLightItalic.ttf,sha256=T-1jb2qyx6MJXPge5Pe731jYLCaqWJg4qpK9ztinSNU,80424
|
|
33
|
+
myplotlib/assets/fonts/Hershey/AVHersheyComplexMedium.ttf,sha256=gSlgv6k8n0rr2QooBqXlErfF2CiCHSuYpRZjRphPEzk,132040
|
|
34
|
+
myplotlib/assets/fonts/Hershey/AVHersheyComplexMediumItalic.ttf,sha256=5pFjXwWK4ZdltD71FWQDrusde1moDbYIUHGG9p8u1pw,123168
|
|
35
|
+
myplotlib/assets/fonts/Hershey/AVHersheyDuplexHeavy.ttf,sha256=8Fwi4DxoKlE9kpn4h1ufqMj089o4FYFRJOd7IiwTjTk,24356
|
|
36
|
+
myplotlib/assets/fonts/Hershey/AVHersheyDuplexHeavyItalic.ttf,sha256=YMtG3wV-CKTMLpIzD6vZIM_fo9RLLEqNGRKWb6eztFY,22544
|
|
37
|
+
myplotlib/assets/fonts/Hershey/AVHersheyDuplexLight.ttf,sha256=S9tijbkOeMU4LFoDiCB20sUu11p565Jz7n3TPi0kARs,44468
|
|
38
|
+
myplotlib/assets/fonts/Hershey/AVHersheyDuplexLightItalic.ttf,sha256=eMF829l6PZuXJLBViPTBe0aTP26EK1vAmqW5NWfdFZU,39724
|
|
39
|
+
myplotlib/assets/fonts/Hershey/AVHersheyDuplexMedium.ttf,sha256=2pZkdZAuOawpp1ywpcsKAE1oQH1u3UKrIcTNhWLnaLI,25640
|
|
40
|
+
myplotlib/assets/fonts/Hershey/AVHersheyDuplexMediumItalic.ttf,sha256=bmBxRsRR1x04bTitk_XtC3WQAYyysXHqSY_gp-RT9v4,23516
|
|
41
|
+
myplotlib/assets/fonts/Hershey/AVHersheySimplexHeavy.ttf,sha256=hQ8JDo0djMfluj7LJ2XZ-g-Blf5bLkuI5b2D-gXneTA,28860
|
|
42
|
+
myplotlib/assets/fonts/Hershey/AVHersheySimplexHeavyItalic.ttf,sha256=YfPqAbWGNTrQiU_-jrwbucMCTUzVtMsLzCsVywajkMA,25056
|
|
43
|
+
myplotlib/assets/fonts/Hershey/AVHersheySimplexLight.ttf,sha256=42N3Wbo5JNte9HXe2SaZouYlHK-o627HV8eu9fLI1YA,69328
|
|
44
|
+
myplotlib/assets/fonts/Hershey/AVHersheySimplexLightItalic.ttf,sha256=0n27pPbhRoY33M1pum8nrP4Zr9rgOYB3WuOPpFaWO8I,53360
|
|
45
|
+
myplotlib/assets/fonts/Hershey/AVHersheySimplexMedium.ttf,sha256=lq-W2gi3kcuRQGrBit-AR-uUk98MDJuayqrERQjry88,30024
|
|
46
|
+
myplotlib/assets/fonts/Hershey/AVHersheySimplexMediumItalic.ttf,sha256=ByJHYJOd7UHLm7ylSipwj-TLeWGuSzXdOKZCnJP4TU8,27244
|
|
47
|
+
myplotlib/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
+
myplotlib/tools/lic.py,sha256=kHRX9x0NRMzvmQLFHUTiAhofLuU8nSvusF3oIWh_BeA,2938
|
|
49
|
+
myplotlib-1.7.0.dist-info/METADATA,sha256=Xfb8QydeX1PL77i3Wr09emNznd0gMa9FR6Z3gTwB8jA,4592
|
|
50
|
+
myplotlib-1.7.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
51
|
+
myplotlib-1.7.0.dist-info/licenses/LICENSE,sha256=X6qMe6RWuOLWn7sNDNXW940gmWFrwGkW429ett0JpoY,1500
|
|
52
|
+
myplotlib-1.7.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Hayk Hakobyan
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|