tikzplot42 0.3.6__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.
Files changed (42) hide show
  1. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/PKG-INFO +5 -3
  2. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/README.md +4 -2
  3. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/pyproject.toml +1 -1
  4. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/axes.py +135 -36
  5. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/axes.pyi +116 -15
  6. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/axes3d.py +2 -2
  7. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/config.py +2 -1
  8. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/config.pyi +1 -0
  9. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/elements.py +109 -53
  10. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/figure.py +71 -30
  11. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/figure.pyi +1 -0
  12. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/plots.py +16 -0
  13. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/plots.pyi +239 -14
  14. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/texts.py +19 -7
  15. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/PKG-INFO +5 -3
  16. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test10.py +3 -3
  17. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test2.py +4 -0
  18. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test7.py +2 -5
  19. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/LICENSE +0 -0
  20. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/setup.cfg +0 -0
  21. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/__init__.py +0 -0
  22. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/__init__.pyi +0 -0
  23. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/colorbar.py +0 -0
  24. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/colorbar.pyi +0 -0
  25. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/colors.py +0 -0
  26. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/colors.pyi +0 -0
  27. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/elements.pyi +0 -0
  28. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/latex_special.py +0 -0
  29. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/py.typed +0 -0
  30. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/state.py +0 -0
  31. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot/state.pyi +0 -0
  32. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/SOURCES.txt +0 -0
  33. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/dependency_links.txt +0 -0
  34. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/requires.txt +0 -0
  35. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/src/tikzplot42.egg-info/top_level.txt +0 -0
  36. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test1.py +0 -0
  37. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test3.py +0 -0
  38. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test4.py +0 -0
  39. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test5.py +0 -0
  40. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test6.py +0 -0
  41. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test8.py +0 -0
  42. {tikzplot42-0.3.6 → tikzplot42-0.3.8}/tests/test9.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tikzplot42
3
- Version: 0.3.6
3
+ Version: 0.3.8
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
@@ -739,11 +739,13 @@ Some basic plot commands are already implemented with commonly used arguments:
739
739
  - `stem()`,
740
740
  - `fill_between()`,
741
741
  - `hlines()/vlines()`,
742
- - `historgam()`,
742
+ - `histogram()`,
743
743
  - `step()`,
744
744
  - `imshow()`,
745
745
  - `text()`,
746
- - `magnify()` (used to magnify part of a plot, but Tikz cannot handle `fill_between` if this one is used, which is a long known issue).
746
+ - `magnify()` (used to magnify part of a plot, but Tikz cannot handle `fill_between` if this one is used, which is a long known issue),
747
+ - `axvline()/axhline()`,
748
+ - `axvspan()/axhspan()` (background span).
747
749
 
748
750
  #### Figures
749
751
  - `plt.figure()` (currently only to give you figure object or to set `figsize`),
@@ -37,11 +37,13 @@ Some basic plot commands are already implemented with commonly used arguments:
37
37
  - `stem()`,
38
38
  - `fill_between()`,
39
39
  - `hlines()/vlines()`,
40
- - `historgam()`,
40
+ - `histogram()`,
41
41
  - `step()`,
42
42
  - `imshow()`,
43
43
  - `text()`,
44
- - `magnify()` (used to magnify part of a plot, but Tikz cannot handle `fill_between` if this one is used, which is a long known issue).
44
+ - `magnify()` (used to magnify part of a plot, but Tikz cannot handle `fill_between` if this one is used, which is a long known issue),
45
+ - `axvline()/axhline()`,
46
+ - `axvspan()/axhspan()` (background span).
45
47
 
46
48
  #### Figures
47
49
  - `plt.figure()` (currently only to give you figure object or to set `figsize`),
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tikzplot42"
7
- version = "0.3.6"
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" }
@@ -17,17 +17,25 @@ class BaseAxes:
17
17
  self._yticks = True
18
18
  self._fig = None
19
19
  if TikzConfig.USE_DECIMAL_COMMA:
20
- self._axis_args.add("/pgf/number format/use comma")
20
+ self._axis_args.add(f"/pgf/number format/.cd, use comma, 1000 sep={{{TikzConfig.THOUSANDS_SEP}}}")
21
+ else:
22
+ self._axis_args.add(f"/pgf/number format/.cd, 1000 sep={{{TikzConfig.THOUSANDS_SEP}}}")
21
23
 
22
24
  self._add_legend = ""
23
25
  self._coordinates = {}
24
26
  self._cmap_bar = None
25
27
 
28
+ self._ext_ymin = False
29
+ self._ext_ymax = False
30
+
26
31
  def _plot(self, x, y, settings=None, xerr=None, yerr=None, **style):
27
32
  if not isinstance(self, Secondary) and self._polar:
28
33
  x = _np.rad2deg(x)
29
34
  e = Graph(self, (x, y), settings, xerr=xerr, yerr=yerr, **style)
30
- self._elements.append(e)
35
+ if TikzConfig.USE_GROUPPLOTS and ("axvspan" == settings or "axhspan" == settings):
36
+ self._elements.insert(0, e)
37
+ else:
38
+ self._elements.append(e)
31
39
  return e
32
40
 
33
41
  def _check_kwargs(self, func, allowed, **kwargs):
@@ -182,6 +190,28 @@ class BaseAxes:
182
190
  return self._plot([xmins[i], xmaxs[i]], [ys[i]]*2, None, None, None, c=colorss[i], ls=lss[i], label=kwargs["label"])
183
191
  else:
184
192
  return self._plot([xmins[i], xmaxs[i]], [ys[i]]*2, None, None, None, c=colorss[i], ls=lss[i])
193
+
194
+ def vlines(self, x, ymin, ymax, colors="k", linestyles="solid", **kwargs):
195
+ kws = {"label"}
196
+ kwargs = self._check_kwargs("vlines", kws, **kwargs)
197
+ def _pad_or_truncate(some_list, target_len):
198
+ return some_list[:target_len] + [some_list[-1]]*(target_len - len(some_list))
199
+ def _to_list(x):
200
+ if x is None:
201
+ return []
202
+ if isinstance(x, (int, float, str)):
203
+ return [x]
204
+ return list(x)
205
+ xs = _to_list(x)
206
+ ymins = _pad_or_truncate(_to_list(ymin), len(xs))
207
+ ymaxs = _pad_or_truncate(_to_list(ymax), len(xs))
208
+ colorss = _pad_or_truncate(_to_list(colors), len(xs))
209
+ lss = _pad_or_truncate(_to_list(linestyles), len(xs))
210
+ for i in range(len(xs)):
211
+ if i == 0 and "label" in kwargs:
212
+ self._plot([xs[i]]*2, [ymins[i], ymaxs[i]], None, None, None, c=colorss[i], ls=lss[i], label=kwargs["label"])
213
+ else:
214
+ self._plot([xs[i]]*2, [ymins[i], ymaxs[i]], None, None, None, c=colorss[i], ls=lss[i])
185
215
 
186
216
  def hist(self, x, bins=10, density=False,**kwargs):
187
217
  #kws = {"alpha", "color", "c", "label"}
@@ -227,6 +257,40 @@ class BaseAxes:
227
257
  if len(args) == 1:
228
258
  kwargs["fmt"] = args[0]
229
259
  return self._plot(x,y,settings=settings, **kwargs)
260
+
261
+ def axvline(self, x, ymin=0, ymax=1, **kwargs):
262
+ kws = {"fmt", "base", "alpha", "color", "c", "linestyle", "ls", "linewidth", "lw", "label"}
263
+ kwargs = self._check_kwargs("axvline", kws, **kwargs)
264
+ self._ext_ymin = self._ext_ymax = True
265
+ self._plot(x, (ymin, ymax), settings="axvline", **kwargs)
266
+
267
+ def axhline(self, y, xmin=0, xmax=1, **kwargs):
268
+ kws = {"fmt", "base", "alpha", "color", "c", "linestyle", "ls", "linewidth", "lw", "label"}
269
+ kwargs = self._check_kwargs("axhline", kws, **kwargs)
270
+ if isinstance(self, Secondary):
271
+ self._primary._ext_xmin = self._primary._ext_xmax = True
272
+ else:
273
+ self._ext_xmin = self._ext_xmax = True
274
+ self._plot((xmin, xmax), y, settings="axhline", **kwargs)
275
+
276
+ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
277
+ kws = {"c", "color", "alpha", "label"}
278
+ kwargs = self._check_kwargs("axvspan", kws, **kwargs)
279
+ self._ext_ymin = self._ext_ymax = True
280
+ if TikzConfig.USE_GROUPPLOTS:
281
+ self._axis_args.add("set layers")
282
+ self._plot([xmin, xmax], [ymin, ymax], settings="axvspan", **kwargs)
283
+
284
+ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
285
+ kws = {"c", "color", "alpha", "label"}
286
+ kwargs = self._check_kwargs("axhspan", kws, **kwargs)
287
+ if isinstance(self, Secondary):
288
+ self._primary._ext_xmin = self._primary._ext_xmax = True
289
+ else:
290
+ self._ext_xmin = self._ext_xmax = True
291
+ if TikzConfig.USE_GROUPPLOTS:
292
+ self._axis_args.add("set layers")
293
+ self._plot([xmin, xmax], [ymin, ymax], settings="axhspan", **kwargs)
230
294
 
231
295
  def set_ylabel(self, label):
232
296
  self._axis_options["ylabel"] = f"{{{tex_text(label)}}}"
@@ -331,10 +395,15 @@ class BaseAxes:
331
395
  for i in range(len(labs)):
332
396
  self._elements[i]._set_label(tex_text(labs[i]))
333
397
 
334
- def text(self, x, y, s, **kwargs):
398
+ def text(self, x, y, s, on_top=True, **kwargs):
335
399
  kws = {"alpha", "color", "c", "fontsize", "size", "backgroundcolor", "horizontalalignment", "ha", "verticalalignment", "va", "rotation", "label"}
336
400
  kwargs = self._check_kwargs("text", kws, **kwargs)
337
- txt = Text(self, x, y, s, **kwargs)
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)
338
407
  self._elements.append(txt)
339
408
 
340
409
  def magnify(self, x_p, y_p, x_m, y_m, zoom, size, **kwargs):
@@ -380,13 +449,20 @@ class BaseAxes:
380
449
  mode = "lin"
381
450
  if arg in self._axis_options:
382
451
  mode = self._axis_options[arg]
452
+ common = self._elements.copy()
453
+ if "x" in which and isinstance(self,Axes) and self._secondary_y:
454
+ common += self._secondary_y._elements
383
455
  if which in self._axis_options:
384
- for e in self._elements:
456
+ for e in common:
385
457
  e._filter(which, self._axis_options[which])
386
458
  return (self._axis_options[which], True, mode)
459
+ values = [e._get_erange(which) for e in common]
460
+ values = [v for v in values if v is not None]
461
+ if not values:
462
+ return (None, False, mode)
387
463
  if "min" in which:
388
- return (min([e._get_erange(which) for e in self._elements]), False, mode)
389
- return (max([e._get_erange(which) for e in self._elements]), False, mode)
464
+ return (min(values), False, mode)
465
+ return (max(values), False, mode)
390
466
 
391
467
  def _get_limit(self, which):
392
468
  arg = f"{which[0]}mode"
@@ -403,6 +479,15 @@ class BaseAxes:
403
479
 
404
480
  def _set_range(self, which, value):
405
481
  self._axis_options[which] = value
482
+ if isinstance(self, Axes):
483
+ if which == "xmin":
484
+ self._ext_xmin = True
485
+ if which == "xmax":
486
+ self._ext_xmax = True
487
+ if which == "ymin":
488
+ self._ext_ymin = True
489
+ if which == "ymax":
490
+ self._ext_ymax = True
406
491
  for e in self._elements:
407
492
  e._filter(which, value)
408
493
 
@@ -443,6 +528,9 @@ class Axes(BaseAxes):
443
528
  self._cbar_h = False
444
529
  self._polar = polar
445
530
 
531
+ self._ext_xmin = False
532
+ self._ext_xmax = False
533
+
446
534
  def _posit_string(): # returns neighbour, neighbour corner, anchor
447
535
  i = self._index
448
536
  if i == 0:
@@ -497,28 +585,6 @@ class Axes(BaseAxes):
497
585
  self._axis_options["log basis x"] = kwargs["base"]
498
586
  return self._plot(x, y, **kwargs)
499
587
 
500
- def vlines(self, x, ymin, ymax, colors="k", linestyles="solid", **kwargs):
501
- kws = {"label"}
502
- kwargs = self._check_kwargs("vlines", kws, **kwargs)
503
- def _pad_or_truncate(some_list, target_len):
504
- return some_list[:target_len] + [some_list[-1]]*(target_len - len(some_list))
505
- def _to_list(x):
506
- if x is None:
507
- return []
508
- if isinstance(x, (int, float, str)):
509
- return [x]
510
- return list(x)
511
- xs = _to_list(x)
512
- ymins = _pad_or_truncate(_to_list(ymin), len(xs))
513
- ymaxs = _pad_or_truncate(_to_list(ymax), len(xs))
514
- colorss = _pad_or_truncate(_to_list(colors), len(xs))
515
- lss = _pad_or_truncate(_to_list(linestyles), len(xs))
516
- for i in range(len(xs)):
517
- if i == 0 and "label" in kwargs:
518
- self._plot([xs[i]]*2, [ymins[i], ymaxs[i]], None, None, None, c=colorss[i], ls=lss[i], label=kwargs["label"])
519
- else:
520
- self._plot([xs[i]]*2, [ymins[i], ymaxs[i]], None, None, None, c=colorss[i], ls=lss[i])
521
-
522
588
  def imshow(self, *args, **kwargs):
523
589
  #kws = {"fmt", "alpha", "color", "c", "linestyle", "ls", "linewidth", "lw", "marker", "markersize", "ms", "label"}
524
590
  #kwargs = self._check_kwargs("imshow", kws, **kwargs)
@@ -626,6 +692,7 @@ class Axes(BaseAxes):
626
692
  if self._polar:
627
693
  raise Exception("Cannot create twinx() on polar plot.")
628
694
  self._secondary_y = Secondary(self)
695
+ self._ext_xmin = self._ext_xmax = True
629
696
  return self._secondary_y
630
697
 
631
698
  def _export_imshow(self, *args, **kwargs):
@@ -669,9 +736,31 @@ class Axes(BaseAxes):
669
736
  axis_opt_str += ",\n".join(self._axis_args)
670
737
  if TikzConfig.SCHOOL_AXIS:
671
738
  axis_opt_str += f",\n axis lines=middle,\n xlabel style={{at={{(ticklabel* cs:{1+TikzConfig.SCHOOL_AXIS_LABEL_MARGIN})}},anchor=north}},\n ylabel style={{at={{(ticklabel* cs:{1+TikzConfig.SCHOOL_AXIS_LABEL_MARGIN})}},anchor=east}}"
739
+ if ("xmin" in self._axis_options and self._axis_options["xmin"] == 0) or ("xmax" in self._axis_options and self._axis_options["xmax"] == 0):
740
+ self._axis_options["extra x ticks"] = r"{0}"
741
+ if ("ymin" in self._axis_options and self._axis_options["ymin"] == 0) or ("ymax" in self._axis_options and self._axis_options["ymax"] == 0):
742
+ self._axis_options["extra y ticks"] = r"{0}"
672
743
  if TikzConfig.USE_GROUPPLOTS:
673
- #axis_opt_str += f",\n set layers,\n axis line style={{on layer=axis foreground}}"
674
- axis_opt_str += f",\n axis on top"
744
+ if TikzConfig.SCHOOL_AXIS:
745
+ axis_opt_str += f",\n set layers,\n axis line style={{on layer=axis foreground}}"
746
+ else:
747
+ axis_opt_str += f",\n axis on top"
748
+ if self._ext_xmin or self._ext_xmax:
749
+ lower = self._get_range("xmin")
750
+ upper = self._get_range("xmax")
751
+ xm, xM = self._fig._range_setting(lower[0], upper[0], lower[2])
752
+ if self._ext_xmin:
753
+ self._axis_options["xmin"] = self._fig._next_limname("xmin", self._axis_options.get("xmin", xm))
754
+ if self._ext_xmax:
755
+ self._axis_options["xmax"] = self._fig._next_limname("xmax", self._axis_options.get("xmax", xM))
756
+ if self._ext_ymin or self._ext_ymax:
757
+ lower = self._get_range("ymin")
758
+ upper = self._get_range("ymax")
759
+ ym, yM = self._fig._range_setting(lower[0], upper[0], lower[2])
760
+ if self._ext_ymin:
761
+ self._axis_options["ymin"] = self._fig._next_limname("ymin", self._axis_options.get("ymin", ym))
762
+ if self._ext_ymax:
763
+ self._axis_options["ymax"] = self._fig._next_limname("ymax", self._axis_options.get("ymax", yM))
675
764
  if self._axis_options:
676
765
  if axis_opt_str: axis_opt_str += ",\n"
677
766
  axis_opt_str += ",\n".join(f"{k}={v}" for k, v in self._axis_options.items())
@@ -709,27 +798,27 @@ class Axes(BaseAxes):
709
798
  def _get_index(self):
710
799
  return self._index
711
800
 
712
- def _to_tex(self, filename):
801
+ def _to_tex(self, filename, single):
713
802
  lines = []
714
803
  lines2 = []
715
- if self._polar and TikzConfig.USE_GROUPPLOTS:
804
+ if self._polar and TikzConfig.USE_GROUPPLOTS and not single:
716
805
  lines.append(f"\\nextgroupplot[alias={self._axis_options['alias']}, width={self._width}, height={self._height}, hide axis]")
717
806
  lines2.append("\\begin{polaraxis}")
718
807
  lines2.append(f"[{self._axis_option_string()}]")
719
808
  lines2.append(self._content_tex(filename))
720
809
  lines2.append("\\end{polaraxis}")
721
810
  else:
722
- if TikzConfig.USE_GROUPPLOTS:
811
+ if TikzConfig.USE_GROUPPLOTS and not single:
723
812
  lines.append("\\nextgroupplot")
724
813
  if self._polar:
725
814
  lines.append("\\begin{polaraxis}")
726
- elif not TikzConfig.USE_GROUPPLOTS:
815
+ elif not TikzConfig.USE_GROUPPLOTS or (TikzConfig.USE_GROUPPLOTS and single):
727
816
  lines.append("\\begin{axis}")
728
817
  lines.append(f"[{self._axis_option_string()}]")
729
818
  lines.append(self._content_tex(filename))
730
819
  if self._polar:
731
820
  lines.append("\\end{polaraxis}")
732
- elif not TikzConfig.USE_GROUPPLOTS:
821
+ elif not TikzConfig.USE_GROUPPLOTS or (TikzConfig.USE_GROUPPLOTS and single):
733
822
 
734
823
  lines.append("\\end{axis}")
735
824
  if self._secondary_y is not None:
@@ -768,6 +857,16 @@ class Secondary(BaseAxes):
768
857
  axis_opt_str = ""
769
858
  if self._axis_args:
770
859
  axis_opt_str += ",\n".join(self._axis_args)
860
+ if self._ext_ymin or self._ext_ymax:
861
+ lower = self._get_range("ymin")
862
+ upper = self._get_range("ymax")
863
+ ym, yM = self._fig._range_setting(lower[0], upper[0], lower[2])
864
+ if self._ext_ymin:
865
+ self._axis_options["ymin"] = self._fig._next_limname("ymin", self._axis_options.get("ymin", ym))
866
+ if self._ext_ymax:
867
+ self._axis_options["ymax"] = self._fig._next_limname("ymax", self._axis_options.get("ymax", yM))
868
+ self._axis_options["xmin"] = self._primary._axis_options["xmin"]
869
+ self._axis_options["xmax"] = self._primary._axis_options["xmax"]
771
870
  if self._axis_options:
772
871
  if axis_opt_str: axis_opt_str += ",\n"
773
872
  axis_opt_str += ",\n".join(f"{k}={v}" for k, v in self._axis_options.items())
@@ -258,6 +258,18 @@ class BaseAxes:
258
258
  Draw horizontal lines to the selected axis.
259
259
  """
260
260
  ...
261
+ def vlines(
262
+ self,
263
+ x: Union[float, Sequence[float]],
264
+ ymin: Union[float, Sequence[float]],
265
+ ymax: Union[float, Sequence[float]],
266
+ colors: Union[str, Sequence[str]] = "k",
267
+ linestyles: Union[str, Sequence[str]] = "solid",
268
+ ) -> None:
269
+ """
270
+ Draw vertical lines to the selected axis.
271
+ """
272
+ ...
261
273
  def hist(
262
274
  self,
263
275
  x: Union[ArrayLike, Sequence[ArrayLike]],
@@ -314,9 +326,109 @@ class BaseAxes:
314
326
  """
315
327
  ...
316
328
 
317
- def spy(self, x_p: float, y_p: float, x_m: float, y_m: float, zoom: float, size: float, **kwargs) -> int:
329
+ def axvline(self, x:float, ymin:float=0, ymax:float=1, alpha:Optional[float] = ..., color:Optional[ColorLike] = ..., linestyle:Optional[str] = ..., linewidth:Optional[float] = ..., label:Optional[str] = ...) -> None:
330
+ """
331
+ Draw a vertical line to the selected axis at given x coordinate.
332
+
333
+ Parameters
334
+ ----------
335
+ x: float
336
+ X coordinate of the line(s)
337
+
338
+ ymin, ymax: float, optional
339
+ Y relative coordinate of the lower and upper end of the line
340
+
341
+ alpha: float, optional
342
+ Opacity
343
+
344
+ color or c: all matplotlib color formats (without X11/xkcd), optional
345
+ color of line: RGB/RGBA (tuple), HEX (str), grayscale (float), single-char (str), name (str), default cycle ("CX", X int), none for invisible
346
+
347
+ linestyle or ls: str, optional
348
+ Line style
349
+
350
+ linewidth or lw: float, optional
351
+ Line width in pt
352
+
353
+ label: str, optional
354
+ Legend entry
355
+ """
356
+
357
+ def axhline(self, y:float, xmin:float=0, xmax:float=1, alpha:Optional[float] = ..., color:Optional[ColorLike] = ..., linestyle:Optional[str] = ..., linewidth:Optional[float] = ..., label:Optional[str] = ...) -> None:
358
+ """
359
+ Draw a horizontal line to the selected axis at given y coordinate.
360
+
361
+ Parameters
362
+ ----------
363
+ y: float
364
+ Y coordinate of the line(s)
365
+
366
+ xmin, xmax: float, optional
367
+ X relative coordinate of the left and right end of the line
368
+
369
+ alpha: float, optional
370
+ Opacity
371
+
372
+ color or c: all matplotlib color formats (without X11/xkcd), optional
373
+ color of line: RGB/RGBA (tuple), HEX (str), grayscale (float), single-char (str), name (str), default cycle ("CX", X int), none for invisible
374
+
375
+ linestyle or ls: str, optional
376
+ Line style
377
+
378
+ linewidth or lw: float, optional
379
+ Line width in pt
380
+
381
+ label: str, optional
382
+ Legend entry
383
+ """
384
+
385
+ def axvspan(self, xmin:float, xmax:float, ymin:float=0, ymax:float=1, alpha:Optional[float] = ..., color:Optional[ColorLike] = ..., label:Optional[str] = ...) -> None:
386
+ """
387
+ Draw a background vertical span to the selected axis between given x coordinates.
388
+
389
+ Parameters
390
+ ----------
391
+ xmin, xmax: float
392
+ X coordinates of the left and right end of the span
393
+
394
+ ymin, ymax: float, optional
395
+ Y relative coordinate of the lower and upper end of the span
396
+
397
+ alpha: float, optional
398
+ Opacity
399
+
400
+ color or c: all matplotlib color formats (without X11/xkcd), optional
401
+ color of line: RGB/RGBA (tuple), HEX (str), grayscale (float), single-char (str), name (str), default cycle ("CX", X int), none for invisible
402
+
403
+ label: str, optional
404
+ Legend entry
405
+ """
406
+
407
+ def axhspan(self, ymin:float, ymax:float, xmin:float=0, xmax:float=1, alpha:Optional[float] = ..., color:Optional[ColorLike] = ..., label:Optional[str] = ...) -> None:
408
+ """
409
+ Draw a background horizontal span to the selected axis between given y coordinates.
410
+
411
+ Parameters
412
+ ----------
413
+ ymin, ymax: float
414
+ Y coordinates of the lower and upper end of the span
415
+
416
+ xmin, xmax: float, optional
417
+ X relative coordinate of the left and right end of the span
418
+
419
+ alpha: float, optional
420
+ Opacity
421
+
422
+ color or c: all matplotlib color formats (without X11/xkcd), optional
423
+ color of line: RGB/RGBA (tuple), HEX (str), grayscale (float), single-char (str), name (str), default cycle ("CX", X int), none for invisible
424
+
425
+ label: str, optional
426
+ Legend entry
427
+ """
428
+
429
+ def magnify(self, x_p: float, y_p: float, x_m: float, y_m: float, zoom: float, size: float, **kwargs) -> int:
318
430
  """
319
- Add a spy to the selected axis.
431
+ Add a spyviewer to the selected axis.
320
432
 
321
433
  Parameters
322
434
  ----------
@@ -368,13 +480,14 @@ class BaseAxes:
368
480
  ...
369
481
  def legend(self, *args: Any, loc: Optional[Union[int,str,Tuple[float,float]]] = ...) -> None:
370
482
  """
371
- Show legend for the selected axis.
483
+ Show legend for the selected axis. Despite arguments requires at least one plotted element on the axis (not necesarily with label) to show up (LaTeX does not allow legend on empty axis).
372
484
 
373
485
  Parameters
374
486
  ----------
375
487
  *args:
376
488
  - single arg: list/tuple, optional: list of labels to assign to axis elements (in given order assigned to plotted elements in the order of plotting). If label is used on any of the elements, the original label is overwritten.
377
489
  - two args: list/tuple, optional: element, label - assign labels to plots (use references of plots which are returned in plot commands). In case that a plot already has a label, both will be displayed. This is the only option to merge the legend entries for double-axis (twinx) plots.
490
+
378
491
  loc: int, str or tuple, optional
379
492
  Location of legend (as in matplotlib: 1 - upper right, 2 - upper left, ... or with tuple of relative coordinates).
380
493
 
@@ -467,18 +580,6 @@ class Axes(BaseAxes):
467
580
  Mark size in pt
468
581
  """
469
582
  ...
470
- def vlines(
471
- self,
472
- x: Union[float, Sequence[float]],
473
- ymin: Union[float, Sequence[float]],
474
- ymax: Union[float, Sequence[float]],
475
- colors: Union[str, Sequence[str]] = "k",
476
- linestyles: Union[str, Sequence[str]] = "solid",
477
- ) -> None:
478
- """
479
- Draw vertical lines to the selected axis.
480
- """
481
- ...
482
583
  def imshow(self, *args: Any, cmap: Optional[str] = ...) -> Tuple[Any, str, float, float]:
483
584
  """
484
585
  Draw image to the selected axis from array. Uses matplotlib imshow() to export to PDF, then inputs the image to the axis. Return may be used to initialize Colorbar().
@@ -553,9 +553,9 @@ class Axes3:
553
553
  def _get_index(self):
554
554
  return self._index
555
555
 
556
- def _to_tex(self, filename):
556
+ def _to_tex(self, filename, single):
557
557
  lines = []
558
- if TikzConfig.USE_GROUPPLOTS:
558
+ if TikzConfig.USE_GROUPPLOTS and not single:
559
559
  lines.append("\\nextgroupplot")
560
560
  lines.append(f"[{self._axis_option_string()}]")
561
561
  lines.append(self._content_tex(filename))
@@ -6,6 +6,7 @@ class _TikzConfig:
6
6
  def __init__(self):
7
7
 
8
8
  self.USE_DECIMAL_COMMA: bool = False
9
+ self.THOUSANDS_SEP: str = ""
9
10
 
10
11
  self.LEGEND_REL_X: float = 0.03
11
12
  self.LEGEND_REL_Y: float = 0.03
@@ -28,7 +29,7 @@ class _TikzConfig:
28
29
 
29
30
  self.SHARED_AXIS_REL_MARGIN: float = 0.08
30
31
 
31
- self.SAVE_DATAPOINTS: bool = True
32
+ self.SAVE_DATAPOINTS: bool = False
32
33
  self.DATAPOINTS_DIR: str = "datapoints" # ignored if SAVE_DATAPOINTS == False
33
34
  self.UPDATE_DATA_ONLY: bool = False # ignored if SAVE_DATAPOINTS == False
34
35
  self.UPDATE_STYLE_ONLY: bool = False # ignored if SAVE_DATAPOINTS == False
@@ -7,6 +7,7 @@ from typing import TypedDict, Unpack, Any, ClassVar, Protocol
7
7
 
8
8
  class _ConfigParams(TypedDict, total=False):
9
9
  USE_DECIMAL_COMMA: bool
10
+ THOUSANDS_SEP: str
10
11
 
11
12
  LEGEND_REL_X: float
12
13
  LEGEND_REL_Y: float