plotlp 0.1.18__tar.gz → 0.1.19__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.
- {plotlp-0.1.18 → plotlp-0.1.19}/PKG-INFO +1 -1
- {plotlp-0.1.18 → plotlp-0.1.19}/pyproject.toml +1 -1
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledAxes_LP/StyledAxes.py +24 -1
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledFigure_LP/StyledFigure.py +32 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/figure_LP/test_figure.py +6 -4
- {plotlp-0.1.18 → plotlp-0.1.19}/README.md +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/.docignore +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledAxes_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledAxes_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledAxes_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledAxes_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledAxes_LP/_functions/scalebar.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledAxes_LP/test_StyledAxes.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledFigure_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledFigure_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledFigure_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledFigure_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledFigure_LP/test_StyledFigure.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/cmap_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/cmap_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/cmap_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/cmap_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/cmap_LP/cmap.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/cmap_LP/test_cmap.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/color_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/color_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/color_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/color_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/color_LP/color.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/color_LP/test_color.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/compare_distributions_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/compare_distributions_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/compare_distributions_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/compare_distributions_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/compare_distributions_LP/compare_distributions.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/compare_distributions_LP/test_compare_distributions.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/figure_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/figure_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/figure_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/figure_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/figure_LP/figure.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/gridsubplots_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/gridsubplots_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/gridsubplots_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/gridsubplots_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/gridsubplots_LP/gridsubplots.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/gridsubplots_LP/test_gridsubplots.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/imgfigure_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/imgfigure_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/imgfigure_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/imgfigure_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/imgfigure_LP/imgfigure.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/imgfigure_LP/test_imgfigure.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/make_animation_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/make_animation_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/make_animation_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/make_animation_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/make_animation_LP/make_animation.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/make_animation_LP/test_make_animation.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/plt_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/plt_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/plt_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/plt_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/plt_LP/plt.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/plt_LP/test_plt.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/_functions/_darkLP.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/_functions/_default.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/_functions/_lightLP.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/_functions/_styleLP.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/style.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/style_LP/test_style.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/subplots_LP/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/subplots_LP/_doctype.txt +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/subplots_LP/_functions/__init__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/subplots_LP/_functions/__template__.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/subplots_LP/subplots.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/subplots_LP/test_subplots.py +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/py.typed +0 -0
- {plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/routines/__init__.py +0 -0
|
@@ -133,6 +133,7 @@ class StyledAxes(Axes) :
|
|
|
133
133
|
if self.polish_imscale : self.imscale()
|
|
134
134
|
if self.polish_noborders : self.noborders()
|
|
135
135
|
if self.polish_equiscale : self.equiscale()
|
|
136
|
+
if self.polish_figscale : self.figscale()
|
|
136
137
|
|
|
137
138
|
# grids
|
|
138
139
|
@prop()
|
|
@@ -179,6 +180,28 @@ class StyledAxes(Axes) :
|
|
|
179
180
|
with plt.style.context(self.style) :
|
|
180
181
|
self.set_aspect(aspect='equal', adjustable='box')
|
|
181
182
|
|
|
183
|
+
# figscale
|
|
184
|
+
@prop()
|
|
185
|
+
def polish_figscale(self) :
|
|
186
|
+
return self.figure.naxes == 1 and not self.polish_imscale and self.polish_equiscale
|
|
187
|
+
def figscale(self) :
|
|
188
|
+
with plt.style.context(self.style) :
|
|
189
|
+
ratio = self.figure.figsize_ratio
|
|
190
|
+
xmin, xmax = self.get_xlim()
|
|
191
|
+
ymin, ymax = self.get_ylim()
|
|
192
|
+
dx, dy = xmax - xmin, ymax - ymin
|
|
193
|
+
x, y = (xmax + xmin) / 2, (ymax + ymin) / 2
|
|
194
|
+
if dx / dy != ratio :
|
|
195
|
+
_dx, _dy = ratio * dy, dx / ratio
|
|
196
|
+
dx = _dx if _dx > dx else dx
|
|
197
|
+
dy = _dy if _dy > dy else dy
|
|
198
|
+
xmin, xmax = x - dx/2, x + dx/2
|
|
199
|
+
ymin, ymax = y - dy/2, y + dy/2
|
|
200
|
+
if self.get_autoscalex_on() :
|
|
201
|
+
self.set_xlim(xmin, xmax)
|
|
202
|
+
if self.get_autoscaley_on() :
|
|
203
|
+
self.set_ylim(ymin, ymax)
|
|
204
|
+
|
|
182
205
|
|
|
183
206
|
|
|
184
207
|
### --- Regenerate parent class methods in the given style ---
|
|
@@ -189,7 +212,7 @@ def is_plottable(method_name, method_obj):
|
|
|
189
212
|
"""
|
|
190
213
|
Returns True if this method should be wrapped automatically.
|
|
191
214
|
"""
|
|
192
|
-
if
|
|
215
|
+
if method_name in StyledAxes.__dict__ : # Already overriden
|
|
193
216
|
return False
|
|
194
217
|
if method_name.startswith("_"): # private
|
|
195
218
|
return False # handled separately
|
|
@@ -156,10 +156,15 @@ class StyledFigure(Figure) :
|
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
|
|
159
|
+
# Merging and splitting
|
|
159
160
|
@property
|
|
160
161
|
def merge(self):
|
|
161
162
|
return _MergeIndexer(self)
|
|
162
163
|
|
|
164
|
+
@property
|
|
165
|
+
def split(self):
|
|
166
|
+
return _SplitIndexer(self)
|
|
167
|
+
|
|
163
168
|
def _normalize_indices(self, idx, size):
|
|
164
169
|
if isinstance(idx, slice):
|
|
165
170
|
return list(range(*idx.indices(size)))
|
|
@@ -198,6 +203,17 @@ class StyledFigure(Figure) :
|
|
|
198
203
|
|
|
199
204
|
return new_ax
|
|
200
205
|
|
|
206
|
+
def _split_axis(self, row, col, height, width):
|
|
207
|
+
|
|
208
|
+
if not hasattr(self, "_axes_grid"):
|
|
209
|
+
raise RuntimeError("merge only works with fig.subplots()")
|
|
210
|
+
|
|
211
|
+
grid = self._axes_grid
|
|
212
|
+
axes_to_merge = [grid[i, j] for i in row for j in col]
|
|
213
|
+
|
|
214
|
+
# TODO
|
|
215
|
+
|
|
216
|
+
return None
|
|
201
217
|
|
|
202
218
|
|
|
203
219
|
# Paper index
|
|
@@ -351,6 +367,22 @@ class _MergeIndexer:
|
|
|
351
367
|
|
|
352
368
|
|
|
353
369
|
|
|
370
|
+
class _SplitIndexer:
|
|
371
|
+
|
|
372
|
+
def __init__(self, fig):
|
|
373
|
+
self.fig = fig
|
|
374
|
+
|
|
375
|
+
def __getitem__(self, key):
|
|
376
|
+
|
|
377
|
+
if not isinstance(key, tuple):
|
|
378
|
+
raise KeyError(f'Splitting figure axis should only be done with two coordinates, not {key}')
|
|
379
|
+
|
|
380
|
+
r, c, h, w = key
|
|
381
|
+
|
|
382
|
+
return self.fig._split_axis(r, c, h, w)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
354
386
|
# %% Test function run
|
|
355
387
|
if __name__ == "__main__":
|
|
356
388
|
from corelp import test
|
|
@@ -31,12 +31,14 @@ def test_plot() :
|
|
|
31
31
|
y = x**2
|
|
32
32
|
fig = figure(figsize_fact=(0.5,0.5), darkmode=True)
|
|
33
33
|
fig.axis.plot(x, -y)
|
|
34
|
+
fig.axis.scatter(x, -y)
|
|
34
35
|
plt.plot(x, y)
|
|
36
|
+
plt.scatter(x, y)
|
|
35
37
|
plt.xlabel('x [ua]')
|
|
36
38
|
fig.axis.set_ylabel('y [ua]')
|
|
37
39
|
fig.title = 'test title'
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
fig.savefig(path_png = debug_folder / 'plot_png', close=False)
|
|
41
|
+
fig.savefig(path_pdf = debug_folder / 'plot_pdf', close=False)
|
|
40
42
|
plt.savefig(debug_folder / 'plot_all')
|
|
41
43
|
|
|
42
44
|
def test_imshow() :
|
|
@@ -50,8 +52,8 @@ def test_imshow() :
|
|
|
50
52
|
fig = figure(figsize_ratio=4/3)
|
|
51
53
|
fig.axis.imshow(img, barname='intensity')
|
|
52
54
|
fig.title = 'test title'
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
fig.savefig(path_png = debug_folder / 'imshow_png', close=False)
|
|
56
|
+
fig.savefig(path_pdf = debug_folder / 'imshow_pdf', close=False)
|
|
55
57
|
plt.savefig(debug_folder / 'imshow_all')
|
|
56
58
|
|
|
57
59
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/StyledFigure_LP/_functions/__template__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/compare_distributions_LP/_functions/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/compare_distributions_LP/compare_distributions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/gridsubplots_LP/_functions/__template__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plotlp-0.1.18 → plotlp-0.1.19}/src/plotlp/modules/make_animation_LP/_functions/__template__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|