EasyPlotLib 0.2.0__tar.gz → 0.2.2__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 (33) hide show
  1. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/figsizes_set.py +14 -5
  2. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib.egg-info/PKG-INFO +1 -1
  3. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib.egg-info/SOURCES.txt +2 -1
  4. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/PKG-INFO +1 -1
  5. easyplotlib-0.2.2/tests/test_subplot_labels.py +28 -0
  6. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/__init__.py +0 -0
  7. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/cartopy_helper.py +0 -0
  8. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/export.py +0 -0
  9. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreadventor-bold.ttf +0 -0
  10. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreadventor-bolditalic.ttf +0 -0
  11. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreadventor-italic.ttf +0 -0
  12. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreadventor-regular.ttf +0 -0
  13. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyrechorus-mediumitalic.ttf +0 -0
  14. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyrecursor-bold.ttf +0 -0
  15. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyrecursor-bolditalic.ttf +0 -0
  16. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyrecursor-italic.ttf +0 -0
  17. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyrecursor-regular.ttf +0 -0
  18. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreheros-bold.ttf +0 -0
  19. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreheros-bolditalic.ttf +0 -0
  20. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreheros-italic.ttf +0 -0
  21. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreheros-regular.ttf +0 -0
  22. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreschola-bold.ttf +0 -0
  23. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreschola-bolditalic.ttf +0 -0
  24. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreschola-italic.ttf +0 -0
  25. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/fonts/texgyreschola-regular.ttf +0 -0
  26. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/helpers.py +0 -0
  27. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/palettes.py +0 -0
  28. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib/styles/nature.mplstyle +0 -0
  29. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib.egg-info/dependency_links.txt +0 -0
  30. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/EasyPlotLib.egg-info/top_level.txt +0 -0
  31. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/README.md +0 -0
  32. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/setup.cfg +0 -0
  33. {easyplotlib-0.2.0 → easyplotlib-0.2.2}/setup.py +0 -0
@@ -33,7 +33,7 @@ _JOURNAL_SIZES = {
33
33
 
34
34
  def figsizes(
35
35
  journal_key,
36
- inverted_aspect_ratio=1,
36
+ inverted_aspect_ratio=None,
37
37
  nrows=None,
38
38
  ncols=None,
39
39
  constrained_layout=True,
@@ -43,9 +43,15 @@ def figsizes(
43
43
  gold_ratio=_GOLDEN_RATIO,
44
44
  ratio=1,
45
45
  ) -> dict:
46
- # set defaul inverted_aspect if nrows
47
- if nrows and ncols:
48
- inverted_aspect_ratio = gold_ratio * nrows / ncols
46
+ # Aspect = height / width. The journal key fixes only the column *width*;
47
+ # the aspect should suit the content, so an explicit ``inverted_aspect_ratio``
48
+ # always wins (use ~1 for square plots, >1 for tall ones). When it is left
49
+ # unset, default to the golden ratio, scaled by the grid shape if given.
50
+ if inverted_aspect_ratio is None:
51
+ if nrows and ncols:
52
+ inverted_aspect_ratio = gold_ratio * nrows / ncols
53
+ else:
54
+ inverted_aspect_ratio = gold_ratio
49
55
  width = _JOURNAL_SIZES[journal_key]
50
56
  if isinstance(width, tuple): # handle case where width is a tuple
51
57
  width = width[0]
@@ -81,7 +87,10 @@ def subplot_labels(
81
87
  xycoords: str = "axes fraction",
82
88
  xytext: Tuple[float, float] = (+0.5, +1),
83
89
  textcoords: str = "offset fontsize",
84
- fontsize: Union[str, int] = "medium",
90
+ # Journals (Nature/Science/Cell) set panel letters a, b, c to 8 pt bold —
91
+ # the one figure element allowed to exceed the 5-7 pt body text. Default to
92
+ # 8 pt rather than "medium" (= body size), which made labels too small.
93
+ fontsize: Union[str, int] = 8,
85
94
  verticalalignment: str = "top",
86
95
  family: str = "sans-serif",
87
96
  weight: str = "bold",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: EasyPlotLib
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A simple plotting library
5
5
  Home-page: https://github.com/yourusername/EasyPlotLib
6
6
  Author: HanYuyang
@@ -27,4 +27,5 @@ EasyPlotLib/fonts/texgyreschola-bold.ttf
27
27
  EasyPlotLib/fonts/texgyreschola-bolditalic.ttf
28
28
  EasyPlotLib/fonts/texgyreschola-italic.ttf
29
29
  EasyPlotLib/fonts/texgyreschola-regular.ttf
30
- EasyPlotLib/styles/nature.mplstyle
30
+ EasyPlotLib/styles/nature.mplstyle
31
+ tests/test_subplot_labels.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: EasyPlotLib
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A simple plotting library
5
5
  Home-page: https://github.com/yourusername/EasyPlotLib
6
6
  Author: HanYuyang
@@ -0,0 +1,28 @@
1
+ """Visual check that panel labels (a, b, c …) render at the 8 pt bold default."""
2
+
3
+ import os
4
+
5
+ import numpy as np
6
+ import matplotlib.pyplot as plt
7
+
8
+ import EasyPlotLib as epl
9
+
10
+ HERE = os.path.dirname(os.path.abspath(__file__))
11
+
12
+ epl.journal_style("nat2", palette="nature", nrows=2, ncols=2)
13
+
14
+ x = np.linspace(0, 10, 100)
15
+ fig, axs = plt.subplots(2, 2)
16
+ for n, ax in enumerate(axs.flatten()):
17
+ ax.plot(x, np.sin(x + n))
18
+ ax.set_xlabel("x axis (units)")
19
+ ax.set_ylabel("y axis (units)")
20
+ ax.annotate(**epl.subplot_labels(n, "a")) # 8 pt bold default
21
+
22
+ d = epl.subplot_labels(0, "a")
23
+ print("subplot_labels fontsize ->", d["fontsize"], "| weight ->", d["weight"])
24
+ print("base font.size (rc) ->", plt.rcParams["font.size"])
25
+
26
+ out = os.path.join(HERE, "test_subplot_labels.png")
27
+ fig.savefig(out, dpi=300)
28
+ print("saved", out)
File without changes
File without changes
File without changes