tikzplot42 0.3.7__tar.gz → 0.3.8__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.
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/PKG-INFO +1 -1
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/pyproject.toml +1 -1
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/axes.py +9 -4
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/config.py +1 -1
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/figure.py +13 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/texts.py +13 -3
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/PKG-INFO +1 -1
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test7.py +2 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/LICENSE +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/README.md +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/setup.cfg +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/__init__.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/__init__.pyi +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/axes.pyi +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/axes3d.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/colorbar.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/colorbar.pyi +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/colors.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/colors.pyi +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/config.pyi +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/elements.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/elements.pyi +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/figure.pyi +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/latex_special.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/plots.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/plots.pyi +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/py.typed +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/state.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot/state.pyi +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/SOURCES.txt +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/dependency_links.txt +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/requires.txt +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/top_level.txt +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test1.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test10.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test2.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test3.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test4.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test5.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test6.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test8.py +0 -0
- {tikzplot42-0.3.7 → tikzplot42-0.3.8}/tests/test9.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tikzplot42"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.8"
|
|
8
8
|
description = "TikzPlot to make TikZ/PGFPlots plots with matplotlib.pyplot-like syntax."
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Zan Ambrozic", email = "zan.ambrozic7@gmail.com" }
|
|
@@ -258,13 +258,13 @@ class BaseAxes:
|
|
|
258
258
|
kwargs["fmt"] = args[0]
|
|
259
259
|
return self._plot(x,y,settings=settings, **kwargs)
|
|
260
260
|
|
|
261
|
-
def axvline(self, x, ymin=0, ymax=
|
|
261
|
+
def axvline(self, x, ymin=0, ymax=1, **kwargs):
|
|
262
262
|
kws = {"fmt", "base", "alpha", "color", "c", "linestyle", "ls", "linewidth", "lw", "label"}
|
|
263
263
|
kwargs = self._check_kwargs("axvline", kws, **kwargs)
|
|
264
264
|
self._ext_ymin = self._ext_ymax = True
|
|
265
265
|
self._plot(x, (ymin, ymax), settings="axvline", **kwargs)
|
|
266
266
|
|
|
267
|
-
def axhline(self, y, xmin=0, xmax=
|
|
267
|
+
def axhline(self, y, xmin=0, xmax=1, **kwargs):
|
|
268
268
|
kws = {"fmt", "base", "alpha", "color", "c", "linestyle", "ls", "linewidth", "lw", "label"}
|
|
269
269
|
kwargs = self._check_kwargs("axhline", kws, **kwargs)
|
|
270
270
|
if isinstance(self, Secondary):
|
|
@@ -395,10 +395,15 @@ class BaseAxes:
|
|
|
395
395
|
for i in range(len(labs)):
|
|
396
396
|
self._elements[i]._set_label(tex_text(labs[i]))
|
|
397
397
|
|
|
398
|
-
def text(self, x, y, s, **kwargs):
|
|
398
|
+
def text(self, x, y, s, on_top=True, **kwargs):
|
|
399
399
|
kws = {"alpha", "color", "c", "fontsize", "size", "backgroundcolor", "horizontalalignment", "ha", "verticalalignment", "va", "rotation", "label"}
|
|
400
400
|
kwargs = self._check_kwargs("text", kws, **kwargs)
|
|
401
|
-
|
|
401
|
+
if on_top:
|
|
402
|
+
coord = self._fig._next_coordinate_name()
|
|
403
|
+
txt = Text(self, x, y, coord, s, **kwargs)
|
|
404
|
+
self._fig._add_text(txt)
|
|
405
|
+
else:
|
|
406
|
+
txt = Text(self, x, y, None, s, **kwargs)
|
|
402
407
|
self._elements.append(txt)
|
|
403
408
|
|
|
404
409
|
def magnify(self, x_p, y_p, x_m, y_m, zoom, size, **kwargs):
|
|
@@ -29,7 +29,7 @@ class _TikzConfig:
|
|
|
29
29
|
|
|
30
30
|
self.SHARED_AXIS_REL_MARGIN: float = 0.08
|
|
31
31
|
|
|
32
|
-
self.SAVE_DATAPOINTS: bool =
|
|
32
|
+
self.SAVE_DATAPOINTS: bool = False
|
|
33
33
|
self.DATAPOINTS_DIR: str = "datapoints" # ignored if SAVE_DATAPOINTS == False
|
|
34
34
|
self.UPDATE_DATA_ONLY: bool = False # ignored if SAVE_DATAPOINTS == False
|
|
35
35
|
self.UPDATE_STYLE_ONLY: bool = False # ignored if SAVE_DATAPOINTS == False
|
|
@@ -30,6 +30,10 @@ class Figure:
|
|
|
30
30
|
self._globals = set()
|
|
31
31
|
self._spies = []
|
|
32
32
|
|
|
33
|
+
self._num_coordinates = 0
|
|
34
|
+
|
|
35
|
+
self.texts = []
|
|
36
|
+
|
|
33
37
|
self._lims = {"xmin": {}, "xmax": {}, "ymin": {}, "ymax": {}}
|
|
34
38
|
|
|
35
39
|
def add_subplot(self, nrows=1, ncols=1, index=1, sharex=None, sharey=None, projection=None, polar=False):
|
|
@@ -301,6 +305,8 @@ class Figure:
|
|
|
301
305
|
lines += lines2
|
|
302
306
|
for spy in self._spies:
|
|
303
307
|
lines.append(spy)
|
|
308
|
+
for text in self.texts:
|
|
309
|
+
lines.append(text._to_tex_fin())
|
|
304
310
|
lines.append("\\end{tikzpicture}")
|
|
305
311
|
for c in self._col_dict:
|
|
306
312
|
r,g,b=self._col_dict[c]
|
|
@@ -340,3 +346,10 @@ class Figure:
|
|
|
340
346
|
|
|
341
347
|
def _add_global(self, setting):
|
|
342
348
|
self._globals.add(setting)
|
|
349
|
+
|
|
350
|
+
def _next_coordinate_name(self):
|
|
351
|
+
self._num_coordinates += 1
|
|
352
|
+
return f"(coordinate{self._num_coordinates})"
|
|
353
|
+
|
|
354
|
+
def _add_text(self, text):
|
|
355
|
+
self.texts.append(text)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from .colors import _tex_color
|
|
2
2
|
|
|
3
3
|
class Text:
|
|
4
|
-
def __init__(self, ax, x, y, s, **kwargs):
|
|
4
|
+
def __init__(self, ax, x, y, coordinate, s, **kwargs):
|
|
5
5
|
self._axes = ax
|
|
6
6
|
self._x = x
|
|
7
7
|
self._y = y
|
|
8
|
+
self._coordinate = coordinate
|
|
8
9
|
self._s = s
|
|
9
10
|
self._kwargs = kwargs
|
|
10
11
|
self._color = False
|
|
@@ -78,10 +79,19 @@ class Text:
|
|
|
78
79
|
|
|
79
80
|
def _to_tex(self, _):
|
|
80
81
|
if self._visible:
|
|
81
|
-
|
|
82
|
+
if self._coordinate is not None:
|
|
83
|
+
return f"\\coordinate {self._coordinate} at (axis cs:{self._x},{self._y});"
|
|
84
|
+
else:
|
|
85
|
+
return f"\\node[{self._style_string()}] at (axis cs:{self._x},{self._y}) {{{self._fsize or ''}{self._s}}};"
|
|
86
|
+
|
|
87
|
+
else:
|
|
88
|
+
return ""
|
|
89
|
+
def _to_tex_fin(self):
|
|
90
|
+
if self._visible:
|
|
91
|
+
if self._coordinate is not None:
|
|
92
|
+
return f"\\node[{self._style_string()}] at {self._coordinate} {{{self._fsize or ''}{self._s}}};"
|
|
82
93
|
else:
|
|
83
94
|
return ""
|
|
84
|
-
|
|
85
95
|
def _set_label(self, label):
|
|
86
96
|
self._label = label
|
|
87
97
|
|
|
@@ -25,6 +25,8 @@ ax = axs[0, 0]
|
|
|
25
25
|
ax.plot(x, y, color="blue", lw=1.5, label="sin(x)")
|
|
26
26
|
ax.plot(x, y2, ls="--", color="red", label="cos(x)")
|
|
27
27
|
ax.text(1.5, 0.5, r"text $\alpha$", color="blue", ha="center", va="center", backgroundcolor="cyan", rotation=30)
|
|
28
|
+
ax.text(1.5, -0.5, r"text $\beta$", color="teal", ha="center", on_top=False, va="center", rotation=-70)
|
|
29
|
+
|
|
28
30
|
ax.grid()
|
|
29
31
|
ax.legend(loc="upper right")
|
|
30
32
|
# =========================
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|