plotstyle 1.2.1__tar.gz → 1.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 (123) hide show
  1. {plotstyle-1.2.1 → plotstyle-1.2.2}/CHANGELOG.md +28 -1
  2. {plotstyle-1.2.1 → plotstyle-1.2.2}/PKG-INFO +19 -12
  3. {plotstyle-1.2.1 → plotstyle-1.2.2}/README.md +18 -11
  4. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/_version.py +2 -2
  5. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/_rendering.py +2 -3
  6. {plotstyle-1.2.1 → plotstyle-1.2.2}/.gitignore +0 -0
  7. {plotstyle-1.2.1 → plotstyle-1.2.2}/LICENSE +0 -0
  8. {plotstyle-1.2.1 → plotstyle-1.2.2}/pyproject.toml +0 -0
  9. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/__init__.py +0 -0
  10. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/_compat/__init__.py +0 -0
  11. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/_compat/mpl_style.py +0 -0
  12. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/_utils/__init__.py +0 -0
  13. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/_utils/io.py +0 -0
  14. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/_utils/warnings.py +0 -0
  15. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/cli/__init__.py +0 -0
  16. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/cli/main.py +0 -0
  17. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/__init__.py +0 -0
  18. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/accessibility.py +0 -0
  19. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/okabe_ito.json +0 -0
  20. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/safe_grayscale.json +0 -0
  21. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_bright.json +0 -0
  22. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_high_contrast.json +0 -0
  23. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_light.json +0 -0
  24. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_muted.json +0 -0
  25. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_rainbow_10.json +0 -0
  26. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_rainbow_12.json +0 -0
  27. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_rainbow_4.json +0 -0
  28. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_rainbow_6.json +0 -0
  29. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_rainbow_8.json +0 -0
  30. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/data/tol_vibrant.json +0 -0
  31. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/grayscale.py +0 -0
  32. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/color/palettes.py +0 -0
  33. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/core/__init__.py +0 -0
  34. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/core/export.py +0 -0
  35. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/core/figure.py +0 -0
  36. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/core/migrate.py +0 -0
  37. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/core/style.py +0 -0
  38. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/engine/__init__.py +0 -0
  39. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/engine/fonts.py +0 -0
  40. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/engine/latex.py +0 -0
  41. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/engine/rcparams.py +0 -0
  42. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/integrations/__init__.py +0 -0
  43. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/integrations/seaborn.py +0 -0
  44. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/__init__.py +0 -0
  45. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/bar.toml +0 -0
  46. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/cjk-japanese.toml +0 -0
  47. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/cjk-korean.toml +0 -0
  48. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/cjk-simplified.toml +0 -0
  49. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/cjk-traditional.toml +0 -0
  50. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/grid.toml +0 -0
  51. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/high-vis.toml +0 -0
  52. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/latex-sans.toml +0 -0
  53. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/minimal.toml +0 -0
  54. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/no-latex.toml +0 -0
  55. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/notebook.toml +0 -0
  56. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/okabe-ito.toml +0 -0
  57. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/pgf.toml +0 -0
  58. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/presentation.toml +0 -0
  59. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/russian.toml +0 -0
  60. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/safe-grayscale.toml +0 -0
  61. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/scatter.toml +0 -0
  62. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/schema.py +0 -0
  63. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-bright.toml +0 -0
  64. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-high-contrast.toml +0 -0
  65. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-light.toml +0 -0
  66. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-muted.toml +0 -0
  67. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-rainbow-10.toml +0 -0
  68. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-rainbow-12.toml +0 -0
  69. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-rainbow-4.toml +0 -0
  70. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-rainbow-6.toml +0 -0
  71. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-rainbow-8.toml +0 -0
  72. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/tol-vibrant.toml +0 -0
  73. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/overlays/turkish.toml +0 -0
  74. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/preview/__init__.py +0 -0
  75. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/preview/gallery.py +0 -0
  76. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/preview/print_size.py +0 -0
  77. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/py.typed +0 -0
  78. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/__init__.py +0 -0
  79. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/_templates.toml +0 -0
  80. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/acs.toml +0 -0
  81. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/cell.toml +0 -0
  82. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/elsevier.toml +0 -0
  83. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/ieee.toml +0 -0
  84. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/nature.toml +0 -0
  85. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/plos.toml +0 -0
  86. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/prl.toml +0 -0
  87. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/schema.py +0 -0
  88. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/science.toml +0 -0
  89. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/springer.toml +0 -0
  90. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/units.py +0 -0
  91. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/specs/wiley.toml +0 -0
  92. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/validation/__init__.py +0 -0
  93. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/validation/checks/__init__.py +0 -0
  94. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/validation/checks/_base.py +0 -0
  95. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/validation/checks/colors.py +0 -0
  96. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/validation/checks/dimensions.py +0 -0
  97. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/validation/checks/export.py +0 -0
  98. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/validation/checks/lines.py +0 -0
  99. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/validation/checks/typography.py +0 -0
  100. {plotstyle-1.2.1 → plotstyle-1.2.2}/src/plotstyle/validation/report.py +0 -0
  101. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/conftest.py +0 -0
  102. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_cli/test_main.py +0 -0
  103. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_color/test_accessibility.py +0 -0
  104. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_color/test_grayscale.py +0 -0
  105. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_color/test_palettes.py +0 -0
  106. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_color/test_rendering.py +0 -0
  107. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_core/test_export.py +0 -0
  108. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_core/test_figure.py +0 -0
  109. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_core/test_migrate.py +0 -0
  110. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_core/test_style.py +0 -0
  111. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_engine/test_fonts.py +0 -0
  112. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_engine/test_latex.py +0 -0
  113. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_engine/test_rcparams.py +0 -0
  114. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_integrations/test_seaborn.py +0 -0
  115. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_preview/test_gallery.py +0 -0
  116. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_preview/test_print_size.py +0 -0
  117. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_specs/test_registry.py +0 -0
  118. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_specs/test_schema.py +0 -0
  119. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_specs/test_units.py +0 -0
  120. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_utils/test_io.py +0 -0
  121. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_utils/test_warnings.py +0 -0
  122. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_validation/test_checks.py +0 -0
  123. {plotstyle-1.2.1 → plotstyle-1.2.2}/tests/test_validation/test_report.py +0 -0
@@ -13,6 +13,32 @@ _Nothing yet._
13
13
 
14
14
  ---
15
15
 
16
+ ## [1.2.2] - 2026-04-27
17
+
18
+ Patch release: docs improvements, README example quality, and CI action bump.
19
+
20
+ ### Added
21
+
22
+ - **`LatexNotFoundError` catch pattern in API docs** (`docs/api/style.md`): new "Catching LaTeX errors" section shows how to import and handle `LatexNotFoundError` directly, with a note on catching the base `RuntimeError` as an alternative.
23
+ - **`examples/output/accessibility_deuteranopia.png`**: new reference output image generated by the `simulate_cvd` section of `04_accessibility_checks.py`.
24
+
25
+ ### Changed
26
+
27
+ - **README overlay examples use realistic data**: notebook and okabe-ito overlay snippets now use `np.linspace` / `np.sin` / `np.cos` plots instead of trivial `[1, 2, 3]` lists; axes labels updated to match.
28
+ - **README overlay snippet import cleanup**: removed stray `import matplotlib.pyplot as plt` from the minimal overlay example where it was unused.
29
+ - **README validation report output updated**: sample terminal output now reflects a two-column figure width rather than a single-column one.
30
+ - **README `diff` output adds `Avoid: none`**: accessibility block in the `plotstyle diff` sample output now shows the `Avoid` field.
31
+ - **`download-artifact` action bumped to v8** in `.github/workflows/release.yml` (was v4).
32
+ - **Version references bumped to 1.2.2** in `README.md` (citation note) and `docs/installation.md` (version-check snippet).
33
+
34
+ ### Fixed
35
+
36
+ - **HiDPI/Retina crash in `_fig_to_rgb_array`** (`src/plotstyle/color/_rendering.py`): `get_width_height()` now passes `physical=True` so the returned pixel dimensions match the `buffer_rgba()` byte count on high-DPI displays, preventing a `ValueError` during the reshape.
37
+ - **Same HiDPI fix in `simulate_cvd` example** (`examples/04_accessibility_checks.py`): the inline canvas-to-array snippet now uses `get_width_height(physical=True)` to stay consistent with the library fix above.
38
+ - **Typo in `06_export_submission.py` docstring**: `"smit_"` author prefix corrected to `"smith_"`.
39
+
40
+ ---
41
+
16
42
  ## [1.2.1] - 2026-04-26
17
43
 
18
44
  Patch release: `simulate_cvd` example, warning quality improvements, and docs/example content fixes.
@@ -146,7 +172,8 @@ First public alpha release.
146
172
  - **Dynamic versioning**: version derived from git tags via `hatch-vcs` and `importlib.metadata`.
147
173
  - **CI/CD pipeline**: GitHub Actions workflows for lint, type-check, test matrix, and automated PyPI release via OIDC Trusted Publishing.
148
174
 
149
- [Unreleased]: https://github.com/rahulkaushal04/plotstyle/compare/v1.2.1...HEAD
175
+ [Unreleased]: https://github.com/rahulkaushal04/plotstyle/compare/v1.2.2...HEAD
176
+ [1.2.2]: https://github.com/rahulkaushal04/plotstyle/compare/v1.2.1...v1.2.2
150
177
  [1.2.1]: https://github.com/rahulkaushal04/plotstyle/compare/v1.2.0...v1.2.1
151
178
  [1.2.0]: https://github.com/rahulkaushal04/plotstyle/compare/v1.1.0...v1.2.0
152
179
  [1.1.0]: https://github.com/rahulkaushal04/plotstyle/compare/v1.0.0...v1.1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotstyle
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Matplotlib/seaborn style presets matching scientific journal requirements, with validation, export safety, and preview capabilities.
5
5
  Project-URL: Homepage, https://github.com/rahulkaushal04/plotstyle
6
6
  Project-URL: Documentation, https://plotstyle.readthedocs.io
@@ -280,7 +280,6 @@ Overlays are additive patches that layer on top of a journal preset. They let yo
280
280
  Pass overlay names in the same list as the journal key:
281
281
 
282
282
  ```python
283
- import matplotlib.pyplot as plt
284
283
  import plotstyle
285
284
 
286
285
  # Strip top/right spines for a clean editorial look
@@ -298,15 +297,19 @@ with plotstyle.use(["nature", "minimal"]) as style:
298
297
  </p>
299
298
 
300
299
  ```python
300
+ import numpy as np
301
301
  import matplotlib.pyplot as plt
302
302
  import plotstyle
303
303
 
304
+ x = np.linspace(0, 2 * np.pi, 100)
305
+
304
306
  # Larger figure and fonts for Jupyter notebooks
305
307
  with plotstyle.use(["nature", "notebook"]) as style:
306
308
  fig, ax = plt.subplots() # plt.subplots() picks up the notebook figsize
307
- ax.plot([1, 2, 3], label="data")
308
- ax.set_xlabel("x")
309
- ax.set_ylabel("y")
309
+ ax.plot(x, np.sin(x), label="sin(x)")
310
+ ax.plot(x, np.cos(x), label="cos(x)")
311
+ ax.set_xlabel("Phase (rad)")
312
+ ax.set_ylabel("Amplitude")
310
313
  ax.legend()
311
314
  style.savefig(fig, "notebook_figure.pdf")
312
315
  ```
@@ -316,13 +319,16 @@ with plotstyle.use(["nature", "notebook"]) as style:
316
319
  </p>
317
320
 
318
321
  ```python
319
- import matplotlib.pyplot as plt
322
+ import numpy as np
320
323
  import plotstyle
321
324
 
325
+ x = np.linspace(0, 2 * np.pi, 100)
326
+
322
327
  # Swap the colour cycle to a specific palette
323
328
  with plotstyle.use(["ieee", "okabe-ito"]) as style:
324
329
  fig, ax = style.figure(columns=1)
325
- ax.plot([1, 2, 3], label="data")
330
+ for i in range(4):
331
+ ax.plot(x, np.sin(x + i * 0.5), label=f"Series {i + 1}")
326
332
  ax.set_xlabel("x")
327
333
  ax.set_ylabel("y")
328
334
  ax.legend()
@@ -442,15 +448,15 @@ with plotstyle.use("nature") as style:
442
448
  ┌──────────────────────────────────────────────────────┐
443
449
  │ PlotStyle Validation Report: Nature │
444
450
  ├──────────┬───────────────────────────────────────────┤
445
- PASS │ Figure width 89.0mm matches single colu...│
446
- │ ✓ PASS │ Figure height 55.0mm is within the Natu...│
451
+ FAIL │ Figure width 162.6mm does not match Nat...│
452
+ │ ✓ PASS │ Figure height 121.9mm is within the Nat...│
447
453
  │ ✗ FAIL │ pdf.fonttype = 3; must be 42 for TrueTy...│
448
454
  │ ✗ FAIL │ ps.fonttype = 3; must be 42 for TrueTyp...│
449
455
  │ ⚠ WARN │ savefig.dpi = 'figure'; Nature requires...│
450
456
  │ ✓ PASS │ All plotted lines and spines meet the N...│
451
- │ ✗ FAIL │ 14 text element(s) outside the Nature r...│
457
+ │ ✗ FAIL │ 23 text element(s) outside the Nature r...│
452
458
  └──────────┴───────────────────────────────────────────┘
453
- 3/7 checks passed, 1 warning(s), 3 failure(s)
459
+ 2/7 checks passed, 1 warning(s), 4 failure(s)
454
460
 
455
461
  passed: False
456
462
 
@@ -580,6 +586,7 @@ Export:
580
586
  Accessibility:
581
587
  Colorblind safe: Not required
582
588
  Grayscale safe: Not required
589
+ Avoid: none
583
590
  ```
584
591
 
585
592
  **`plotstyle diff nature science`**
@@ -673,7 +680,7 @@ If PlotStyle helps your research, a citation or star is appreciated:
673
680
  title = {PlotStyle: Publication-ready scientific figure presets for Matplotlib},
674
681
  year = {2026},
675
682
  url = {https://github.com/rahulkaushal04/plotstyle},
676
- note = {Version 1.2.1},
683
+ note = {Version 1.2.2},
677
684
  }
678
685
  ```
679
686
 
@@ -199,7 +199,6 @@ Overlays are additive patches that layer on top of a journal preset. They let yo
199
199
  Pass overlay names in the same list as the journal key:
200
200
 
201
201
  ```python
202
- import matplotlib.pyplot as plt
203
202
  import plotstyle
204
203
 
205
204
  # Strip top/right spines for a clean editorial look
@@ -217,15 +216,19 @@ with plotstyle.use(["nature", "minimal"]) as style:
217
216
  </p>
218
217
 
219
218
  ```python
219
+ import numpy as np
220
220
  import matplotlib.pyplot as plt
221
221
  import plotstyle
222
222
 
223
+ x = np.linspace(0, 2 * np.pi, 100)
224
+
223
225
  # Larger figure and fonts for Jupyter notebooks
224
226
  with plotstyle.use(["nature", "notebook"]) as style:
225
227
  fig, ax = plt.subplots() # plt.subplots() picks up the notebook figsize
226
- ax.plot([1, 2, 3], label="data")
227
- ax.set_xlabel("x")
228
- ax.set_ylabel("y")
228
+ ax.plot(x, np.sin(x), label="sin(x)")
229
+ ax.plot(x, np.cos(x), label="cos(x)")
230
+ ax.set_xlabel("Phase (rad)")
231
+ ax.set_ylabel("Amplitude")
229
232
  ax.legend()
230
233
  style.savefig(fig, "notebook_figure.pdf")
231
234
  ```
@@ -235,13 +238,16 @@ with plotstyle.use(["nature", "notebook"]) as style:
235
238
  </p>
236
239
 
237
240
  ```python
238
- import matplotlib.pyplot as plt
241
+ import numpy as np
239
242
  import plotstyle
240
243
 
244
+ x = np.linspace(0, 2 * np.pi, 100)
245
+
241
246
  # Swap the colour cycle to a specific palette
242
247
  with plotstyle.use(["ieee", "okabe-ito"]) as style:
243
248
  fig, ax = style.figure(columns=1)
244
- ax.plot([1, 2, 3], label="data")
249
+ for i in range(4):
250
+ ax.plot(x, np.sin(x + i * 0.5), label=f"Series {i + 1}")
245
251
  ax.set_xlabel("x")
246
252
  ax.set_ylabel("y")
247
253
  ax.legend()
@@ -361,15 +367,15 @@ with plotstyle.use("nature") as style:
361
367
  ┌──────────────────────────────────────────────────────┐
362
368
  │ PlotStyle Validation Report: Nature │
363
369
  ├──────────┬───────────────────────────────────────────┤
364
- PASS │ Figure width 89.0mm matches single colu...│
365
- │ ✓ PASS │ Figure height 55.0mm is within the Natu...│
370
+ FAIL │ Figure width 162.6mm does not match Nat...│
371
+ │ ✓ PASS │ Figure height 121.9mm is within the Nat...│
366
372
  │ ✗ FAIL │ pdf.fonttype = 3; must be 42 for TrueTy...│
367
373
  │ ✗ FAIL │ ps.fonttype = 3; must be 42 for TrueTyp...│
368
374
  │ ⚠ WARN │ savefig.dpi = 'figure'; Nature requires...│
369
375
  │ ✓ PASS │ All plotted lines and spines meet the N...│
370
- │ ✗ FAIL │ 14 text element(s) outside the Nature r...│
376
+ │ ✗ FAIL │ 23 text element(s) outside the Nature r...│
371
377
  └──────────┴───────────────────────────────────────────┘
372
- 3/7 checks passed, 1 warning(s), 3 failure(s)
378
+ 2/7 checks passed, 1 warning(s), 4 failure(s)
373
379
 
374
380
  passed: False
375
381
 
@@ -499,6 +505,7 @@ Export:
499
505
  Accessibility:
500
506
  Colorblind safe: Not required
501
507
  Grayscale safe: Not required
508
+ Avoid: none
502
509
  ```
503
510
 
504
511
  **`plotstyle diff nature science`**
@@ -592,7 +599,7 @@ If PlotStyle helps your research, a citation or star is appreciated:
592
599
  title = {PlotStyle: Publication-ready scientific figure presets for Matplotlib},
593
600
  year = {2026},
594
601
  url = {https://github.com/rahulkaushal04/plotstyle},
595
- note = {Version 1.2.1},
602
+ note = {Version 1.2.2},
596
603
  }
597
604
  ```
598
605
 
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.2.1'
22
- __version_tuple__ = version_tuple = (1, 2, 1)
21
+ __version__ = version = '1.2.2'
22
+ __version_tuple__ = version_tuple = (1, 2, 2)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -30,9 +30,8 @@ def _fig_to_rgb_array(fig: Figure) -> NDArray[np.uint8]:
30
30
  """
31
31
  fig.canvas.draw()
32
32
 
33
- # get_width_height() reads actual canvas pixel dimensions; avoids
34
- # off-by-one from float rounding in int(fig_in * dpi).
35
- width, height = fig.canvas.get_width_height()
33
+ # physical=True matches the buffer_rgba() byte count on HiDPI/Retina screens.
34
+ width, height = fig.canvas.get_width_height(physical=True)
36
35
 
37
36
  # buffer_rgba() returns a read-only memoryview; .copy() makes it writeable
38
37
  rgba = np.frombuffer(fig.canvas.buffer_rgba(), dtype=np.uint8).reshape(height, width, 4)
File without changes
File without changes
File without changes
File without changes