tikzplot42 0.6.0__tar.gz → 0.6.3__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.6.0 → tikzplot42-0.6.3}/PKG-INFO +2 -1
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/README.md +1 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/pyproject.toml +1 -1
- tikzplot42-0.6.3/src/tikzplot/arrows.py +87 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/axes.py +367 -200
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/axes.pyi +215 -121
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/axes3d.py +34 -13
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/axes3d.pyi +6 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/colorbar.py +4 -3
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/elements.py +31 -21
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/figure.py +39 -12
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/latex_special.py +1 -1
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/pie.py +5 -2
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/plots.py +5 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/plots.pyi +73 -6
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/texts.py +3 -3
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot42.egg-info/PKG-INFO +2 -1
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot42.egg-info/SOURCES.txt +1 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test13.py +1 -1
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test7.py +1 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/LICENSE +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/setup.cfg +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/__init__.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/__init__.pyi +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/border_finder.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/colorbar.pyi +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/colors.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/config.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/config.pyi +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/elements.pyi +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/figure.pyi +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/py.typed +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/state.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/styles.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot/styles.pyi +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot42.egg-info/dependency_links.txt +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot42.egg-info/requires.txt +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/src/tikzplot42.egg-info/top_level.txt +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test1.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test10.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test11.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test12.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test14.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test15.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test16.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test17.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test18.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test19.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test2.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test20.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test21.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test22.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test23.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test24.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test25.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test26.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test27.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test28.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test3.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test4.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test5.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test6.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test8.py +0 -0
- {tikzplot42-0.6.0 → tikzplot42-0.6.3}/tests/test9.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tikzplot42
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary: TikzPlot to make TikZ/PGFPlots plots with matplotlib.pyplot-like syntax.
|
|
5
5
|
Author-email: Zan Ambrozic <zan.ambrozic7@gmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -764,6 +764,7 @@ Some basic plot commands are already implemented with commonly used arguments:
|
|
|
764
764
|
- `imshow()`,
|
|
765
765
|
- `matshow()`,
|
|
766
766
|
- `text()`,
|
|
767
|
+
- `annotate()`,
|
|
767
768
|
- `bxp()` (without notches),
|
|
768
769
|
- `boxplot()` (without notches),
|
|
769
770
|
- `violin()`,
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tikzplot42"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.3"
|
|
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" }
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from .colors import _tex_color
|
|
2
|
+
|
|
3
|
+
class Arrow:
|
|
4
|
+
_LINE_MAP = {"--": "dashed", ":": "dotted", "-.": "dashdotted", "-":"solid"}
|
|
5
|
+
def __init__(self, ax, x1, y1, x2, y2, coordinate1, coordinate2, **kwargs):
|
|
6
|
+
self._axes = ax
|
|
7
|
+
self._x1 = x1
|
|
8
|
+
self._y1 = y1
|
|
9
|
+
self._x2 = x2
|
|
10
|
+
self._y2 = y2
|
|
11
|
+
self._coordinate1 = coordinate1
|
|
12
|
+
self._coordinate2 = coordinate2
|
|
13
|
+
self._kwargs = kwargs
|
|
14
|
+
self._opacity = 1
|
|
15
|
+
self._visible = True
|
|
16
|
+
|
|
17
|
+
def match_color(self, input):
|
|
18
|
+
self._has_color = True
|
|
19
|
+
ccode, op = _tex_color(input)
|
|
20
|
+
if not isinstance(op, bool):
|
|
21
|
+
self._opacity = op
|
|
22
|
+
if isinstance(ccode, str):
|
|
23
|
+
return ccode
|
|
24
|
+
r,g,b=ccode
|
|
25
|
+
self._axes._add_col(r,g,b)
|
|
26
|
+
return f"c{r:.3f}{g:.3f}{b:.3f}".replace(".", "")
|
|
27
|
+
|
|
28
|
+
def _style_string(self):
|
|
29
|
+
output = []
|
|
30
|
+
if "arrowstyle" in self._kwargs:
|
|
31
|
+
allowed = {"<", ">", "|", "stealth", "latex"}
|
|
32
|
+
arstyle = self._kwargs["arrowstyle"]
|
|
33
|
+
arstyle = arstyle.split("-")
|
|
34
|
+
if not all(s in allowed for s in arstyle):
|
|
35
|
+
raise ValueError(f"Arrow style {self._kwargs['arrowstyle']} not recognized. Valid options should consist of: {allowed}, separated by -.")
|
|
36
|
+
output.append(self._kwargs["arrowstyle"])
|
|
37
|
+
if "color" in self._kwargs or "c" in self._kwargs:
|
|
38
|
+
self._color = self.match_color(self._kwargs.get("color") or self._kwargs.get("c"))
|
|
39
|
+
if "alpha" in self._kwargs:
|
|
40
|
+
self._opacity = self._kwargs["alpha"]
|
|
41
|
+
if "line width" in self._kwargs or "lw" in self._kwargs:
|
|
42
|
+
output.append("line width=" + str(self._kwargs.get("line width") or self._kwargs.get("lw")))
|
|
43
|
+
if "linestyle" in self._kwargs or "ls" in self._kwargs:
|
|
44
|
+
ls = self._kwargs.get("linestyle") or self._kwargs.get("ls")
|
|
45
|
+
if ls in self._LINE_MAP:
|
|
46
|
+
ls = self._LINE_MAP[ls]
|
|
47
|
+
elif ls not in self._LINE_MAP.values():
|
|
48
|
+
raise ValueError(f"Line style {ls} not recognized. Valid options are: {list(self._LINE_MAP.keys())}.")
|
|
49
|
+
output.append("line style=" + str(ls))
|
|
50
|
+
if self._opacity < 1:
|
|
51
|
+
output.insert(0,f"opacity={self._opacity}")
|
|
52
|
+
if self._color:
|
|
53
|
+
output.insert(0,f"color={self._color}")
|
|
54
|
+
return ", ".join(output)
|
|
55
|
+
|
|
56
|
+
def _to_tex(self, *args, **kwargs):
|
|
57
|
+
if self._visible:
|
|
58
|
+
if self._coordinate1 is not None:
|
|
59
|
+
return f"\\coordinate {self._coordinate1} at (axis cs:{self._x1},{self._y1});"
|
|
60
|
+
else:
|
|
61
|
+
return ""
|
|
62
|
+
|
|
63
|
+
def _to_tex_fin(self):
|
|
64
|
+
if self._visible:
|
|
65
|
+
if self._coordinate1 is not None and self._coordinate2 is not None:
|
|
66
|
+
return f"\\draw[{self._style_string()}] {self._coordinate2} -- {self._coordinate1};"
|
|
67
|
+
else:
|
|
68
|
+
return ""
|
|
69
|
+
|
|
70
|
+
def _filter(self, which, label):
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
def _get_erange(self, which):
|
|
74
|
+
if which == "xmin":
|
|
75
|
+
return min(self._x1, self._x2)
|
|
76
|
+
elif which == "xmax":
|
|
77
|
+
return max(self._x1, self._x2)
|
|
78
|
+
elif which == "ymin":
|
|
79
|
+
return min(self._y1, self._y2)
|
|
80
|
+
elif which == "ymax":
|
|
81
|
+
return max(self._y1, self._y2)
|
|
82
|
+
|
|
83
|
+
def _num_points(self):
|
|
84
|
+
return 2
|
|
85
|
+
|
|
86
|
+
def _reduce_points(self, max_points):
|
|
87
|
+
pass
|