tikzplot42 0.5.14__tar.gz → 0.6.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.
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/PKG-INFO +2 -1
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/README.md +1 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/pyproject.toml +1 -1
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/axes.py +37 -19
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/axes.pyi +3 -3
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/elements.py +2 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/figure.py +9 -7
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/figure.pyi +3 -3
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot42.egg-info/PKG-INFO +2 -1
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot42.egg-info/SOURCES.txt +1 -0
- tikzplot42-0.6.0/tests/test28.py +34 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/LICENSE +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/setup.cfg +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/__init__.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/__init__.pyi +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/axes3d.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/axes3d.pyi +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/border_finder.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/colorbar.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/colorbar.pyi +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/colors.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/config.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/config.pyi +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/elements.pyi +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/latex_special.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/pie.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/plots.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/plots.pyi +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/py.typed +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/state.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/styles.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/styles.pyi +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot/texts.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot42.egg-info/dependency_links.txt +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot42.egg-info/requires.txt +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/src/tikzplot42.egg-info/top_level.txt +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test1.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test10.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test11.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test12.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test13.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test14.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test15.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test16.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test17.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test18.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test19.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test2.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test20.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test21.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test22.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test23.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test24.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test25.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test26.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test27.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test3.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test4.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test5.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test6.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test7.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test8.py +0 -0
- {tikzplot42-0.5.14 → tikzplot42-0.6.0}/tests/test9.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tikzplot42
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
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
|
|
@@ -735,6 +735,7 @@ All required packages are automatically detected and can be printed at save usin
|
|
|
735
735
|
- `\usepgfplotslibrary{groupplots}` (recommended for best results, enabled by default, may be avoided by setting TikzConfig USE_GROUPPLOTS=False),
|
|
736
736
|
- `\usepackage{xcolor}` (recommended for best colors, works without but needs change of TikzConfig USE_XCOLOR=False),
|
|
737
737
|
- `\usepgfplotslibrary{polar}` required for polar axis,
|
|
738
|
+
- `\usepgfplotslibrary{smithchart}` required for Smith chart axis,
|
|
738
739
|
- `\usetikzlibrary{patterns.meta}` for hatch patterns (available for fill_between, hist and axvspan/axhspan).
|
|
739
740
|
|
|
740
741
|
Export using `plt.savefig("example_graph.tex")` (recommended) or `plt.show()`.
|
|
@@ -35,6 +35,7 @@ All required packages are automatically detected and can be printed at save usin
|
|
|
35
35
|
- `\usepgfplotslibrary{groupplots}` (recommended for best results, enabled by default, may be avoided by setting TikzConfig USE_GROUPPLOTS=False),
|
|
36
36
|
- `\usepackage{xcolor}` (recommended for best colors, works without but needs change of TikzConfig USE_XCOLOR=False),
|
|
37
37
|
- `\usepgfplotslibrary{polar}` required for polar axis,
|
|
38
|
+
- `\usepgfplotslibrary{smithchart}` required for Smith chart axis,
|
|
38
39
|
- `\usetikzlibrary{patterns.meta}` for hatch patterns (available for fill_between, hist and axvspan/axhspan).
|
|
39
40
|
|
|
40
41
|
Export using `plt.savefig("example_graph.tex")` (recommended) or `plt.show()`.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tikzplot42"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.6.0"
|
|
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" }
|
|
@@ -174,7 +174,7 @@ class BaseAxes:
|
|
|
174
174
|
if cb is not None:
|
|
175
175
|
if self._cmap_bar.get(self._get_overlay(), None) is not None and self._cmap_bar[self._get_overlay()] != cb:
|
|
176
176
|
self._get_free_overlay(cb=cb)
|
|
177
|
-
if isinstance(self, Axes) and self.
|
|
177
|
+
if isinstance(self, Axes) and self._projection == "polar":
|
|
178
178
|
x = _np.rad2deg(x)
|
|
179
179
|
e = Graph(self, (x, y), settings, xerr=xerr, yerr=yerr, **style)
|
|
180
180
|
if overlay is None:
|
|
@@ -2451,7 +2451,7 @@ class BaseAxes:
|
|
|
2451
2451
|
self._axis_options["ymin"], self._axis_options["ymax"] = ymax, ymin
|
|
2452
2452
|
|
|
2453
2453
|
class Axes(BaseAxes):
|
|
2454
|
-
def __init__(self, nrows, ncols, index, fig,
|
|
2454
|
+
def __init__(self, nrows, ncols, index, fig, projection):
|
|
2455
2455
|
super().__init__()
|
|
2456
2456
|
self._left = False
|
|
2457
2457
|
self._neigh = None
|
|
@@ -2474,7 +2474,7 @@ class Axes(BaseAxes):
|
|
|
2474
2474
|
self._colorbar: dict[int, None|str] = {0: None}
|
|
2475
2475
|
self._cbar_v = False
|
|
2476
2476
|
self._cbar_h = False
|
|
2477
|
-
self.
|
|
2477
|
+
self._projection = projection
|
|
2478
2478
|
|
|
2479
2479
|
self._ext_xmin = False
|
|
2480
2480
|
self._ext_xmax = False
|
|
@@ -2869,8 +2869,8 @@ class Axes(BaseAxes):
|
|
|
2869
2869
|
self._xticks = False
|
|
2870
2870
|
|
|
2871
2871
|
def twinx(self):
|
|
2872
|
-
if self.
|
|
2873
|
-
raise Exception("Cannot create twinx() on
|
|
2872
|
+
if self._projection in ["polar", "smith"]:
|
|
2873
|
+
raise Exception("Cannot create twinx() on non-normal projection.")
|
|
2874
2874
|
self._secondary_y = Secondary(self)
|
|
2875
2875
|
self._ext_xmin = self._ext_xmax = True
|
|
2876
2876
|
self.tick_params(axis="y", right=False)
|
|
@@ -3127,16 +3127,20 @@ class Axes(BaseAxes):
|
|
|
3127
3127
|
self._overlay_special[k].update({key: val}) """
|
|
3128
3128
|
lines = []
|
|
3129
3129
|
lines2 = []
|
|
3130
|
-
if self.
|
|
3130
|
+
if self._projection == "polar":
|
|
3131
3131
|
self._fig._add_required_package("\\usepgfplotslibrary{polar}")
|
|
3132
|
+
elif self._projection == "smith":
|
|
3133
|
+
self._fig._add_required_package("\\usepgfplotslibrary{smithchart}")
|
|
3132
3134
|
main_ax, aux_ax, alias, adds = self._axis_option_string()
|
|
3133
3135
|
contents = self._content_tex(filename)
|
|
3134
3136
|
if self._extend is not None:
|
|
3135
3137
|
lines.append(f"\\nextgroupplot[alias={alias}, width={self._extend[0]}cm, height={self._extend[1]}cm, hide axis]")
|
|
3136
3138
|
for i in self._elements.keys():
|
|
3137
3139
|
spec = ",\n".join([self._parse_entry(k, v) for k, v in self._overlay_special.get(i, {}).items()]) + ",\n" if i in self._overlay_special else ""
|
|
3138
|
-
if self.
|
|
3140
|
+
if self._projection == "polar":
|
|
3139
3141
|
lines2.append("\\begin{polaraxis}["+ f"\n at={{({alias}.south west)}},")
|
|
3142
|
+
elif self._projection == "smith":
|
|
3143
|
+
lines2.append("\\begin{smithchart}["+ f"\n at={{({alias}.south west)}},")
|
|
3140
3144
|
else:
|
|
3141
3145
|
lines2.append("\\begin{axis}[" + f"\n at={{({alias}.south west)}},")
|
|
3142
3146
|
if TikzConfig.SCALE_ONLY_AXIS:
|
|
@@ -3146,8 +3150,10 @@ class Axes(BaseAxes):
|
|
|
3146
3150
|
else:
|
|
3147
3151
|
lines2.append(f"{aux_ax}{spec}\n]")
|
|
3148
3152
|
lines2.append(contents[i])
|
|
3149
|
-
if self.
|
|
3153
|
+
if self._projection == "polar":
|
|
3150
3154
|
lines2.append("\\end{polaraxis}")
|
|
3155
|
+
elif self._projection == "smith":
|
|
3156
|
+
lines2.append("\\end{smithchart}")
|
|
3151
3157
|
else:
|
|
3152
3158
|
lines2.append("\\end{axis}")
|
|
3153
3159
|
if self._secondary_y is not None:
|
|
@@ -3171,32 +3177,42 @@ class Axes(BaseAxes):
|
|
|
3171
3177
|
if add_l:
|
|
3172
3178
|
lines2.append(add_l)
|
|
3173
3179
|
lines2.append("\\end{axis}")
|
|
3174
|
-
elif self.
|
|
3175
|
-
lines.append(f"\\nextgroupplot[alias={
|
|
3180
|
+
elif self._projection in ["polar", "smith"] and TikzConfig.USE_GROUPPLOTS and not single:
|
|
3181
|
+
lines.append(f"\\nextgroupplot[alias={alias}, width={self._width}, height={self._height}, hide axis]")
|
|
3176
3182
|
for i in self._elements.keys():
|
|
3177
3183
|
spec = ",\n".join([self._parse_entry(k, v) for k, v in self._overlay_special.get(i, {}).items()]) + ",\n" if i in self._overlay_special else ""
|
|
3178
3184
|
if i in adds:
|
|
3179
3185
|
spec += adds[i]
|
|
3180
|
-
|
|
3186
|
+
if self._projection == "polar":
|
|
3187
|
+
lines2.append("\\begin{polaraxis}["+ f"\n at={{({alias}.south west)}},")
|
|
3188
|
+
elif self._projection == "smith":
|
|
3189
|
+
lines2.append("\\begin{smithchart}["+ f"\n at={{({alias}.south west)}},")
|
|
3181
3190
|
if TikzConfig.SCALE_ONLY_AXIS:
|
|
3182
|
-
lines2.append("scale only axis")
|
|
3191
|
+
lines2.append("scale only axis,")
|
|
3183
3192
|
if i == self._get_overlay():
|
|
3184
3193
|
lines2.append(f"{main_ax}{spec}\n]")
|
|
3185
3194
|
else:
|
|
3186
3195
|
lines2.append(f"{aux_ax}{spec}\n]")
|
|
3187
3196
|
lines2.append(contents[i])
|
|
3188
|
-
|
|
3197
|
+
if self._projection == "polar":
|
|
3198
|
+
lines2.append("\\end{polaraxis}")
|
|
3199
|
+
elif self._projection == "smith":
|
|
3200
|
+
lines2.append("\\end{smithchart}")
|
|
3189
3201
|
else:
|
|
3190
|
-
if
|
|
3191
|
-
lines.append("\\nextgroupplot[")
|
|
3192
|
-
if self._polar:
|
|
3202
|
+
if self._projection == "polar":
|
|
3193
3203
|
lines.append("\\begin{polaraxis}[")
|
|
3194
3204
|
if TikzConfig.SCALE_ONLY_AXIS:
|
|
3195
|
-
lines.append("scale only axis")
|
|
3205
|
+
lines.append("scale only axis,")
|
|
3206
|
+
elif self._projection == "smith":
|
|
3207
|
+
lines.append("\\begin{smithchart}[")
|
|
3208
|
+
if TikzConfig.SCALE_ONLY_AXIS:
|
|
3209
|
+
lines.append("scale only axis,")
|
|
3210
|
+
elif TikzConfig.USE_GROUPPLOTS and not single:
|
|
3211
|
+
lines.append("\\nextgroupplot[")
|
|
3196
3212
|
elif not TikzConfig.USE_GROUPPLOTS or (TikzConfig.USE_GROUPPLOTS and single):
|
|
3197
3213
|
lines.append("\\begin{axis}[")
|
|
3198
3214
|
if TikzConfig.SCALE_ONLY_AXIS:
|
|
3199
|
-
lines.append("scale only axis")
|
|
3215
|
+
lines.append("scale only axis,")
|
|
3200
3216
|
if self._get_overlay() == 0:
|
|
3201
3217
|
spec = ",\n".join([self._parse_entry(k, v) for k, v in self._overlay_special.get(0, {}).items()]) + ",\n" if 0 in self._overlay_special else ""
|
|
3202
3218
|
if 0 in adds:
|
|
@@ -3231,8 +3247,10 @@ class Axes(BaseAxes):
|
|
|
3231
3247
|
lines2.append(f"{aux_ax}{spec}at={{({alias}.south west)}}\n]")
|
|
3232
3248
|
lines2.append(contents[i])
|
|
3233
3249
|
lines2.append("\\end{axis}")
|
|
3234
|
-
if self.
|
|
3250
|
+
if self._projection == "polar":
|
|
3235
3251
|
lines.append("\\end{polaraxis}")
|
|
3252
|
+
elif self._projection == "smith":
|
|
3253
|
+
lines.append("\\end{smithchart}")
|
|
3236
3254
|
elif not TikzConfig.USE_GROUPPLOTS or (TikzConfig.USE_GROUPPLOTS and single):
|
|
3237
3255
|
lines.append("\\end{axis}")
|
|
3238
3256
|
if self._secondary_y is not None:
|
|
@@ -404,7 +404,7 @@ class BaseAxes:
|
|
|
404
404
|
colors: Union[str, Sequence[str]] = "k",
|
|
405
405
|
linestyles: Union[str, Sequence[str]] = "solid",
|
|
406
406
|
label: Optional[str] = None, color: Optional[ColorLike] = ..., c: Optional[ColorLike] = ..., linewidth: Optional[float] = ..., lw: Optional[float] = ..., linestyle: Optional[LineStyle] = ..., ls: Optional[LineStyle] = ..., alpha: float = 1.0
|
|
407
|
-
) ->
|
|
407
|
+
) -> list[Graph]:
|
|
408
408
|
"""
|
|
409
409
|
Draw horizontal lines to the selected axis.
|
|
410
410
|
"""
|
|
@@ -417,7 +417,7 @@ class BaseAxes:
|
|
|
417
417
|
colors: Union[str, Sequence[str]] = "k",
|
|
418
418
|
linestyles: Union[str, Sequence[str]] = "solid",
|
|
419
419
|
label: Optional[str] = None, color: Optional[ColorLike] = ..., c: Optional[ColorLike] = ..., linewidth: Optional[float] = ..., lw: Optional[float] = ..., linestyle: Optional[LineStyle] = ..., ls: Optional[LineStyle] = ..., alpha: float = 1.0
|
|
420
|
-
) ->
|
|
420
|
+
) -> list[Graph]:
|
|
421
421
|
"""
|
|
422
422
|
Draw vertical lines to the selected axis.
|
|
423
423
|
"""
|
|
@@ -1949,7 +1949,7 @@ class BaseAxes:
|
|
|
1949
1949
|
def _not_hidable(self) -> None: ...
|
|
1950
1950
|
|
|
1951
1951
|
class Axes(BaseAxes):
|
|
1952
|
-
def __init__(self, nrows: int, ncols: int, index: int, fig: Any,
|
|
1952
|
+
def __init__(self, nrows: int, ncols: int, index: int, fig: Any, projection: Literal["normal", "polar", "smith"] = "normal") -> None: ...
|
|
1953
1953
|
|
|
1954
1954
|
def contourf(self, *args: Any, levels: Optional[Sequence[float]] = None, cmap: Optional[str] = None, colors: Optional[Sequence[ColorLike]] = None, vmin: Optional[float] = None, vmax: Optional[float] = None, alpha: float = 1.0) -> Graph:
|
|
1955
1955
|
"""
|
|
@@ -760,6 +760,8 @@ class Graph(BaseGraph):
|
|
|
760
760
|
style = self._style_string().removesuffix(",\n")
|
|
761
761
|
|
|
762
762
|
def rel_coor(which, m, M, v):
|
|
763
|
+
if isinstance(m, str) or isinstance(M, str):
|
|
764
|
+
return m, M
|
|
763
765
|
if self._axes._axis_options.get(f"{which}mode") == "log":
|
|
764
766
|
r = M/m
|
|
765
767
|
lower = m * r**v[0]
|
|
@@ -62,9 +62,11 @@ class Figure:
|
|
|
62
62
|
|
|
63
63
|
if projection=="3d":
|
|
64
64
|
ax = Axes3(nrows, ncols, index, self)
|
|
65
|
+
elif projection is None or projection in ["normal", "polar", "smith"]:
|
|
66
|
+
proj: str = "polar" if polar else projection if projection is not None else "normal"
|
|
67
|
+
ax = Axes(nrows, ncols, index, self, proj)
|
|
65
68
|
else:
|
|
66
|
-
|
|
67
|
-
ax = Axes(nrows, ncols, index, self, pol)
|
|
69
|
+
raise ValueError(f"Invalid projection type: {projection}. If specified, must be 'normal', 'polar', 'smith', or '3d'.")
|
|
68
70
|
if self._nrows != 0 and self._ncols != 0 and (self._nrows != nrows or self._ncols != ncols):
|
|
69
71
|
raise ValueError("Cannot add subplot with different nrows/ncols than existing subplots")
|
|
70
72
|
self._nrows = nrows
|
|
@@ -214,25 +216,25 @@ class Figure:
|
|
|
214
216
|
new_name = get_free_name()
|
|
215
217
|
if position == "left":
|
|
216
218
|
insert_col(target_c)
|
|
217
|
-
new_axes = Axes(self._nrows, self._ncols, 0, self,
|
|
219
|
+
new_axes = Axes(self._nrows, self._ncols, 0, self, "normal")
|
|
218
220
|
self._mosaic[new_name] = dict(r=target_r, c=target_c, nr=target_nr, nc=1, ax=new_axes)
|
|
219
221
|
if self._wratios is not None:
|
|
220
222
|
self._wratios.insert(target_c, sum_w * relsize)
|
|
221
223
|
elif position == "right":
|
|
222
224
|
insert_col(target_c + target_nc)
|
|
223
|
-
new_axes = Axes(self._nrows, self._ncols, 0, self,
|
|
225
|
+
new_axes = Axes(self._nrows, self._ncols, 0, self, "normal")
|
|
224
226
|
self._mosaic[new_name] = dict(r=target_r, c=target_c + target_nc, nr=target_nr, nc=1, ax=new_axes)
|
|
225
227
|
if self._wratios is not None:
|
|
226
228
|
self._wratios.insert(target_c + target_nc, sum_w * relsize)
|
|
227
229
|
elif position == "above":
|
|
228
230
|
insert_row(target_r_top)
|
|
229
|
-
new_axes = Axes(self._nrows, self._ncols, 0, self,
|
|
231
|
+
new_axes = Axes(self._nrows, self._ncols, 0, self, "normal")
|
|
230
232
|
self._mosaic[new_name] = dict(r=target_r_top, c=target_c, nr=1, nc=target_nc, ax=new_axes)
|
|
231
233
|
if self._hratios is not None:
|
|
232
234
|
self._hratios.insert(target_r_top, sum_h * relsize)
|
|
233
235
|
else: # below
|
|
234
236
|
insert_row(target_r + 1)
|
|
235
|
-
new_axes = Axes(self._nrows, self._ncols, 0, self,
|
|
237
|
+
new_axes = Axes(self._nrows, self._ncols, 0, self, "normal")
|
|
236
238
|
self._mosaic[new_name] = dict(r=target_r + 1, c=target_c, nr=1, nc=target_nc, ax=new_axes)
|
|
237
239
|
if self._hratios is not None:
|
|
238
240
|
self._hratios.insert(target_r + 1, sum_h * relsize)
|
|
@@ -578,7 +580,7 @@ class Figure:
|
|
|
578
580
|
ncols = self._ncols
|
|
579
581
|
for i in range(1, 1 + nrows * ncols):
|
|
580
582
|
if i not in self._axes:
|
|
581
|
-
self._axes[i] = Axes(nrows, ncols, -i, self,
|
|
583
|
+
self._axes[i] = Axes(nrows, ncols, -i, self, "normal")
|
|
582
584
|
if TikzConfig.USE_GROUPPLOTS and not single:
|
|
583
585
|
if TikzConfig.SIMULATE_SIZES:
|
|
584
586
|
if _can_compile_tex():
|
|
@@ -30,7 +30,7 @@ class Figure:
|
|
|
30
30
|
*args,
|
|
31
31
|
sharex: Optional[ShareOptions] = None,
|
|
32
32
|
sharey: Optional[ShareOptions] = None,
|
|
33
|
-
projection: Optional[Literal["polar"]] = None,
|
|
33
|
+
projection: Optional[Literal["normal", "polar", "smith"]] = None,
|
|
34
34
|
polar: Optional[bool] = False,
|
|
35
35
|
) -> Axes:
|
|
36
36
|
...
|
|
@@ -45,8 +45,8 @@ class Figure:
|
|
|
45
45
|
sharex, sharey: bool or "row" or "col" or "all" or "none", optional
|
|
46
46
|
Share x or y axes with other subplots.
|
|
47
47
|
|
|
48
|
-
projection: None, "polar", "3d", optional
|
|
49
|
-
None results in normal 2D.
|
|
48
|
+
projection: None or "normal", "polar", "smith", "3d", optional
|
|
49
|
+
None results in normal 2D. For Smith projection, complex input should be provided as cartesian (x = z.real, y = z.imag).
|
|
50
50
|
|
|
51
51
|
polar: bool, optional
|
|
52
52
|
Use polar projection for axis.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tikzplot42
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
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
|
|
@@ -735,6 +735,7 @@ All required packages are automatically detected and can be printed at save usin
|
|
|
735
735
|
- `\usepgfplotslibrary{groupplots}` (recommended for best results, enabled by default, may be avoided by setting TikzConfig USE_GROUPPLOTS=False),
|
|
736
736
|
- `\usepackage{xcolor}` (recommended for best colors, works without but needs change of TikzConfig USE_XCOLOR=False),
|
|
737
737
|
- `\usepgfplotslibrary{polar}` required for polar axis,
|
|
738
|
+
- `\usepgfplotslibrary{smithchart}` required for Smith chart axis,
|
|
738
739
|
- `\usetikzlibrary{patterns.meta}` for hatch patterns (available for fill_between, hist and axvspan/axhspan).
|
|
739
740
|
|
|
740
741
|
Export using `plt.savefig("example_graph.tex")` (recommended) or `plt.show()`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import tikzplot.plots as plt
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
# Sample data
|
|
5
|
+
x = np.linspace(0, 2 * np.pi, 100)
|
|
6
|
+
y = np.sin(x)
|
|
7
|
+
|
|
8
|
+
fig = plt.figure(figsize=(8, 8))
|
|
9
|
+
|
|
10
|
+
# 1. Normal (Rectilinear) Projection
|
|
11
|
+
ax1 = fig.add_subplot(2, 2, 1)
|
|
12
|
+
ax1.plot(x, y, color="tab:blue")
|
|
13
|
+
ax1.set_title("Normal Projection")
|
|
14
|
+
ax1.grid(True)
|
|
15
|
+
|
|
16
|
+
# 2. 3D Projection
|
|
17
|
+
ax2 = fig.add_subplot(2, 2, 2, projection="3d")
|
|
18
|
+
z = np.cos(x)
|
|
19
|
+
ax2.plot(x, y, z, color="tab:orange")
|
|
20
|
+
ax2.set_title("3D Projection")
|
|
21
|
+
|
|
22
|
+
# 3. Polar Projection
|
|
23
|
+
ax3 = fig.add_subplot(2, 2, 3, projection="polar")
|
|
24
|
+
ax3.plot(x, y, color="tab:green")
|
|
25
|
+
ax3.set_title("Polar Projection")
|
|
26
|
+
|
|
27
|
+
# 4. Smith Chart Projection (requires your custom package imported beforehand)
|
|
28
|
+
ax4 = fig.add_subplot(2, 2, 4, projection="smith")
|
|
29
|
+
# Dummy impedance data (S-parameters / reflection coefficient)
|
|
30
|
+
z_smith = 0.5 + 0.5j + 0.4 * np.exp(1j * x)
|
|
31
|
+
ax4.plot(z_smith.real, z_smith.imag, color="tab:red")
|
|
32
|
+
ax4.set_title("Smith Projection")
|
|
33
|
+
|
|
34
|
+
plt.savefig("figure.tex")
|
|
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
|
|
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
|