plotstyle 1.1.0__tar.gz → 1.2.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.
- {plotstyle-1.1.0 → plotstyle-1.2.0}/CHANGELOG.md +34 -1
- {plotstyle-1.1.0 → plotstyle-1.2.0}/PKG-INFO +243 -16
- plotstyle-1.2.0/README.md +513 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/pyproject.toml +3 -2
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/__init__.py +43 -1
- plotstyle-1.2.0/src/plotstyle/_compat/__init__.py +13 -0
- plotstyle-1.2.0/src/plotstyle/_compat/mpl_style.py +137 -0
- plotstyle-1.2.0/src/plotstyle/_utils/__init__.py +17 -0
- plotstyle-1.2.0/src/plotstyle/_utils/warnings.py +38 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/_version.py +2 -2
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/cli/main.py +157 -10
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/_rendering.py +3 -3
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/data/tol_bright.json +1 -1
- plotstyle-1.2.0/src/plotstyle/color/data/tol_high_contrast.json +5 -0
- plotstyle-1.2.0/src/plotstyle/color/data/tol_light.json +5 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/data/tol_muted.json +1 -1
- plotstyle-1.2.0/src/plotstyle/color/data/tol_rainbow_10.json +5 -0
- plotstyle-1.2.0/src/plotstyle/color/data/tol_rainbow_12.json +5 -0
- plotstyle-1.2.0/src/plotstyle/color/data/tol_rainbow_4.json +5 -0
- plotstyle-1.2.0/src/plotstyle/color/data/tol_rainbow_6.json +5 -0
- plotstyle-1.2.0/src/plotstyle/color/data/tol_rainbow_8.json +5 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/data/tol_vibrant.json +1 -1
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/grayscale.py +9 -2
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/palettes.py +76 -8
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/core/export.py +18 -1
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/core/figure.py +11 -8
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/core/migrate.py +25 -12
- plotstyle-1.2.0/src/plotstyle/core/style.py +836 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/engine/fonts.py +38 -8
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/engine/rcparams.py +100 -21
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/integrations/seaborn.py +5 -6
- plotstyle-1.2.0/src/plotstyle/overlays/__init__.py +252 -0
- plotstyle-1.2.0/src/plotstyle/overlays/bar.toml +10 -0
- plotstyle-1.2.0/src/plotstyle/overlays/cjk-japanese.toml +17 -0
- plotstyle-1.2.0/src/plotstyle/overlays/cjk-korean.toml +17 -0
- plotstyle-1.2.0/src/plotstyle/overlays/cjk-simplified.toml +17 -0
- plotstyle-1.2.0/src/plotstyle/overlays/cjk-traditional.toml +17 -0
- plotstyle-1.2.0/src/plotstyle/overlays/grid.toml +10 -0
- plotstyle-1.2.0/src/plotstyle/overlays/high-vis.toml +13 -0
- plotstyle-1.2.0/src/plotstyle/overlays/latex-sans.toml +10 -0
- plotstyle-1.2.0/src/plotstyle/overlays/minimal.toml +12 -0
- plotstyle-1.2.0/src/plotstyle/overlays/no-latex.toml +9 -0
- plotstyle-1.2.0/src/plotstyle/overlays/notebook.toml +16 -0
- plotstyle-1.2.0/src/plotstyle/overlays/okabe-ito.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/pgf.toml +9 -0
- plotstyle-1.2.0/src/plotstyle/overlays/presentation.toml +14 -0
- plotstyle-1.2.0/src/plotstyle/overlays/russian.toml +15 -0
- plotstyle-1.2.0/src/plotstyle/overlays/safe-grayscale.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/scatter.toml +11 -0
- plotstyle-1.2.0/src/plotstyle/overlays/schema.py +125 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-bright.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-high-contrast.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-light.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-muted.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-rainbow-10.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-rainbow-12.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-rainbow-4.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-rainbow-6.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-rainbow-8.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/tol-vibrant.toml +7 -0
- plotstyle-1.2.0/src/plotstyle/overlays/turkish.toml +15 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/specs/__init__.py +35 -5
- plotstyle-1.2.0/src/plotstyle/specs/acs.toml +32 -0
- plotstyle-1.2.0/src/plotstyle/specs/cell.toml +35 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/specs/elsevier.toml +9 -13
- plotstyle-1.2.0/src/plotstyle/specs/ieee.toml +31 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/specs/nature.toml +7 -10
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/specs/plos.toml +7 -10
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/specs/prl.toml +7 -12
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/specs/schema.py +144 -38
- plotstyle-1.2.0/src/plotstyle/specs/science.toml +31 -0
- plotstyle-1.2.0/src/plotstyle/specs/springer.toml +26 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/specs/units.py +8 -2
- plotstyle-1.2.0/src/plotstyle/specs/wiley.toml +27 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/validation/checks/dimensions.py +50 -19
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/validation/checks/lines.py +29 -12
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/validation/checks/typography.py +32 -12
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_color/test_palettes.py +3 -2
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_core/test_export.py +3 -3
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_core/test_migrate.py +4 -32
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_core/test_style.py +3 -3
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_engine/test_fonts.py +6 -1
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_specs/test_registry.py +7 -4
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_specs/test_schema.py +1 -48
- plotstyle-1.1.0/README.md +0 -306
- plotstyle-1.1.0/src/plotstyle/_utils/warnings.py +0 -13
- plotstyle-1.1.0/src/plotstyle/core/style.py +0 -580
- plotstyle-1.1.0/src/plotstyle/integrations/__init__.py +0 -0
- plotstyle-1.1.0/src/plotstyle/specs/acs.toml +0 -36
- plotstyle-1.1.0/src/plotstyle/specs/cell.toml +0 -35
- plotstyle-1.1.0/src/plotstyle/specs/ieee.toml +0 -35
- plotstyle-1.1.0/src/plotstyle/specs/science.toml +0 -35
- plotstyle-1.1.0/src/plotstyle/specs/springer.toml +0 -35
- plotstyle-1.1.0/src/plotstyle/specs/wiley.toml +0 -35
- {plotstyle-1.1.0 → plotstyle-1.2.0}/.gitignore +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/LICENSE +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/_utils/io.py +0 -0
- {plotstyle-1.1.0/src/plotstyle/_utils → plotstyle-1.2.0/src/plotstyle/cli}/__init__.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/__init__.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/accessibility.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/data/okabe_ito.json +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/color/data/safe_grayscale.json +0 -0
- {plotstyle-1.1.0/src/plotstyle/cli → plotstyle-1.2.0/src/plotstyle/core}/__init__.py +0 -0
- {plotstyle-1.1.0/src/plotstyle/core → plotstyle-1.2.0/src/plotstyle/engine}/__init__.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/engine/latex.py +0 -0
- {plotstyle-1.1.0/src/plotstyle/engine → plotstyle-1.2.0/src/plotstyle/integrations}/__init__.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/preview/__init__.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/preview/gallery.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/preview/print_size.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/py.typed +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/specs/_templates.toml +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/validation/__init__.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/validation/checks/__init__.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/validation/checks/_base.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/validation/checks/colors.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/validation/checks/export.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/src/plotstyle/validation/report.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/conftest.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_cli/test_main.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_color/test_accessibility.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_color/test_grayscale.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_color/test_rendering.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_core/test_figure.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_engine/test_latex.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_engine/test_rcparams.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_integrations/test_seaborn.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_preview/test_gallery.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_preview/test_print_size.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_specs/test_units.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_utils/test_io.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_utils/test_warnings.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_validation/test_checks.py +0 -0
- {plotstyle-1.1.0 → plotstyle-1.2.0}/tests/test_validation/test_report.py +0 -0
|
@@ -13,6 +13,38 @@ _Nothing yet._
|
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
|
+
## [1.2.0] - 2026-04-23
|
|
17
|
+
|
|
18
|
+
Feature release: **overlays**, **units & conversions**, **Seaborn integration**, improved **font/LaTeX controls**, plus major CLI/docs/example expansion.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **Style overlays** (`plotstyle.overlays`, `plotstyle.list_overlays()`): additive layers that can be composed with a base journal preset.
|
|
23
|
+
- Categories: `color`, `context`, `rendering`, `plot-type`, `script`.
|
|
24
|
+
- Built-in overlays include `minimal`, `notebook`, `presentation`, `high-vis`, `grid`, `bar`, `scatter`, `no-latex`, `pgf`, `latex-sans`, `okabe-ito`, `safe-grayscale`, and `tol-*` palette overlays, plus CJK/Turkish/Russian script overlays.
|
|
25
|
+
- **New CLI commands for overlays**
|
|
26
|
+
- `plotstyle overlays [--category <category>]` to list overlays.
|
|
27
|
+
- `plotstyle overlay-info <overlay>` to inspect overlay metadata and `rcParams`.
|
|
28
|
+
- **Font checks for overlays**: `plotstyle fonts --overlay <overlay>` (in addition to `--journal`).
|
|
29
|
+
- **Seaborn integration**: helpers to keep PlotStyle `rcParams` consistent when using Seaborn themes (`patch_seaborn()`, `plotstyle_theme()`, `unpatch_seaborn()`).
|
|
30
|
+
- **Units & conversions**: new/expanded utilities and docs for consistent size specification across specs and helpers.
|
|
31
|
+
- **Matplotlib-native styles compatibility**: support for registering/using PlotStyle presets as Matplotlib styles where applicable.
|
|
32
|
+
- **New examples & previews**: additional example scripts including overlays, Seaborn integration, units/conversions, print-size preview, Matplotlib native styles, and LaTeX/fonts.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **CLI UX improvements**
|
|
37
|
+
- `plotstyle fonts` now supports `--journal` *or* `--overlay` (mutually exclusive, required).
|
|
38
|
+
- More robust argument parsing (e.g. ignores empty entries in `--formats`).
|
|
39
|
+
- Friendlier output for empty registries (journals/overlays) and clearer reporting for overlay font availability.
|
|
40
|
+
- **Docs & README expansion**: new/expanded guides and API reference for overlays, units, warnings, Seaborn, preview tooling, and updated patterns/examples.
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- **CLI stability**: avoid noisy/unclear behavior in edge cases (empty registry listings, malformed format lists) and improve error messaging around missing overlay keys.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
16
48
|
## [1.1.0] - 2026-04-16
|
|
17
49
|
|
|
18
50
|
Minor feature release : ergonomics improvements, hardened error handling, and spec updates.
|
|
@@ -95,7 +127,8 @@ First public alpha release.
|
|
|
95
127
|
- **Dynamic versioning** — version derived from git tags via `hatch-vcs` and `importlib.metadata`.
|
|
96
128
|
- **CI/CD pipeline** — GitHub Actions workflows for lint, type-check, test matrix, and automated PyPI release via OIDC Trusted Publishing.
|
|
97
129
|
|
|
98
|
-
[Unreleased]: https://github.com/rahulkaushal04/plotstyle/compare/v1.
|
|
130
|
+
[Unreleased]: https://github.com/rahulkaushal04/plotstyle/compare/v1.2.0...HEAD
|
|
131
|
+
[1.2.0]: https://github.com/rahulkaushal04/plotstyle/compare/v1.1.0...v1.2.0
|
|
99
132
|
[1.1.0]: https://github.com/rahulkaushal04/plotstyle/compare/v1.0.0...v1.1.0
|
|
100
133
|
[1.0.0]: https://github.com/rahulkaushal04/plotstyle/compare/v0.1.0a2...v1.0.0
|
|
101
134
|
[0.1.0a2]: https://github.com/rahulkaushal04/plotstyle/compare/v0.1.0a1...v0.1.0a2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotstyle
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
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
|
|
@@ -9,7 +9,27 @@ Project-URL: Issues, https://github.com/rahulkaushal04/plotstyle/issues
|
|
|
9
9
|
Project-URL: Changelog, https://github.com/rahulkaushal04/plotstyle/blob/main/CHANGELOG.md
|
|
10
10
|
Project-URL: Download, https://pypi.org/project/plotstyle/
|
|
11
11
|
Author: Rahul Kaushal
|
|
12
|
-
License: MIT
|
|
12
|
+
License: MIT License
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2026 Rahul Kaushal
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
in the Software without restriction, including without limitation the rights
|
|
19
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
furnished to do so, subject to the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
copies or substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
SOFTWARE.
|
|
13
33
|
License-File: LICENSE
|
|
14
34
|
Keywords: academic,accessibility,colorblind,export,figures,ieee,journal,matplotlib,nature,plotting,publication,rcParams,research,science,scientific,seaborn,style,typesetting,validation,visualization
|
|
15
35
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -88,6 +108,7 @@ Description-Content-Type: text/markdown
|
|
|
88
108
|
- [Examples](#examples)
|
|
89
109
|
- [Multi-panel figures](#multi-panel-figures)
|
|
90
110
|
- [Color palettes](#color-palettes)
|
|
111
|
+
- [Overlays](#overlays)
|
|
91
112
|
- [Colorblind and grayscale previews](#colorblind-and-grayscale-previews)
|
|
92
113
|
- [Validation and submission export](#validation-and-submission-export)
|
|
93
114
|
- [Supported Journals](#supported-journals)
|
|
@@ -137,7 +158,7 @@ with plotstyle.use("nature") as style:
|
|
|
137
158
|
```
|
|
138
159
|
|
|
139
160
|
<p align="center">
|
|
140
|
-
<img src="examples/output/quickstart_nature.png" width="55%" alt="Quickstart output: sin and cos figure styled for Nature">
|
|
161
|
+
<img src="https://raw.githubusercontent.com/rahulkaushal04/plotstyle/main/examples/output/quickstart_nature.png" width="55%" alt="Quickstart output: sin and cos figure styled for Nature">
|
|
141
162
|
</p>
|
|
142
163
|
|
|
143
164
|
The `with` block is the recommended pattern. Matplotlib's `rcParams` are restored automatically when it exits, even if an exception occurs.
|
|
@@ -148,7 +169,7 @@ The `with` block is the recommended pattern. Matplotlib's `rcParams` are restore
|
|
|
148
169
|
|
|
149
170
|
### Multi-panel figures
|
|
150
171
|
|
|
151
|
-
`style.subplots()` works like `plt.subplots()` but sizes the figure to the journal spec and adds panel labels automatically
|
|
172
|
+
`style.subplots()` works like `plt.subplots()` but sizes the figure to the journal spec and adds panel labels automatically. All built-in journal specs use bold lowercase labels (**a**, **b**, **c**, …). The label style is driven by each spec's `panel_label_case` field and can be `lower`, `upper`, `parens_lower`, `parens_upper`, `sentence`, or `title`.
|
|
152
173
|
|
|
153
174
|
```python
|
|
154
175
|
import numpy as np
|
|
@@ -184,7 +205,7 @@ with plotstyle.use("science") as style:
|
|
|
184
205
|
```
|
|
185
206
|
|
|
186
207
|
<p align="center">
|
|
187
|
-
<img src="examples/output/multi_panel_science.png" width="70%" alt="2x2 multi-panel Science figure with automatic panel labels
|
|
208
|
+
<img src="https://raw.githubusercontent.com/rahulkaushal04/plotstyle/main/examples/output/multi_panel_science.png" width="70%" alt="2x2 multi-panel Science figure with automatic panel labels a b c d">
|
|
188
209
|
</p>
|
|
189
210
|
|
|
190
211
|
> `axes` is always a 2-D NumPy array. Use `axes[0, 0]` to access a single panel or `axes.flat` to iterate. Pass `panels=False` to suppress the automatic labels.
|
|
@@ -202,7 +223,7 @@ import plotstyle
|
|
|
202
223
|
journals = ["nature", "science", "ieee", "acs"]
|
|
203
224
|
fig, axes = plt.subplots(len(journals), 1, figsize=(6, 0.6 * len(journals)))
|
|
204
225
|
|
|
205
|
-
for ax, journal in zip(axes, journals):
|
|
226
|
+
for ax, journal in zip(axes, journals, strict=False):
|
|
206
227
|
pal = plotstyle.palette(journal, n=8)
|
|
207
228
|
for i, color in enumerate(pal):
|
|
208
229
|
ax.barh(0, 1, left=i, color=color, edgecolor="none", height=0.8)
|
|
@@ -217,7 +238,7 @@ fig.savefig("palette_comparison.png", dpi=150)
|
|
|
217
238
|
```
|
|
218
239
|
|
|
219
240
|
<p align="center">
|
|
220
|
-
<img src="examples/output/palette_comparison.png" width="70%" alt="Color swatch comparison for Nature, Science, IEEE, and ACS palettes">
|
|
241
|
+
<img src="https://raw.githubusercontent.com/rahulkaushal04/plotstyle/main/examples/output/palette_comparison.png" width="70%" alt="Color swatch comparison for Nature, Science, IEEE, and ACS palettes">
|
|
221
242
|
</p>
|
|
222
243
|
|
|
223
244
|
Pass `with_markers=True` to get `(color, linestyle, marker)` tuples, useful for journals like IEEE that print in grayscale:
|
|
@@ -228,6 +249,66 @@ for color, ls, marker in styled:
|
|
|
228
249
|
ax.plot(x, y, color=color, linestyle=ls, marker=marker)
|
|
229
250
|
```
|
|
230
251
|
|
|
252
|
+
```text
|
|
253
|
+
# styled — one (color, linestyle, marker) tuple per series:
|
|
254
|
+
[('#000000', '-', 'o'), ('#333333', '--', 's'), ('#666666', '-.', '^'), ('#999999', ':', 'D')]
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
### Overlays
|
|
260
|
+
|
|
261
|
+
Overlays are additive patches that layer on top of a journal preset. They let you adjust one aspect of a figure — the colour palette, the context, the chart type — without changing the base journal settings.
|
|
262
|
+
|
|
263
|
+
Pass overlay names in the same list as the journal key:
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
import plotstyle
|
|
267
|
+
|
|
268
|
+
# Strip top/right spines for a clean editorial look
|
|
269
|
+
with plotstyle.use(["nature", "minimal"]) as style:
|
|
270
|
+
fig, ax = style.figure(columns=1)
|
|
271
|
+
ax.plot([1, 2, 3])
|
|
272
|
+
style.savefig(fig, "figure.pdf")
|
|
273
|
+
|
|
274
|
+
# Larger figure and fonts for Jupyter notebooks
|
|
275
|
+
with plotstyle.use(["nature", "notebook"]) as style:
|
|
276
|
+
import matplotlib.pyplot as plt
|
|
277
|
+
fig, ax = plt.subplots() # plt.subplots() picks up the notebook figsize
|
|
278
|
+
ax.plot([1, 2, 3])
|
|
279
|
+
|
|
280
|
+
# Swap the colour cycle to a specific palette
|
|
281
|
+
with plotstyle.use(["ieee", "okabe-ito"]) as style:
|
|
282
|
+
fig, ax = style.figure(columns=1)
|
|
283
|
+
ax.plot([1, 2, 3])
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
| Category | Purpose | Examples |
|
|
287
|
+
|----------|---------|---------|
|
|
288
|
+
| `color` | Swap the colour cycle | `okabe-ito`, `tol-bright`, `safe-grayscale` |
|
|
289
|
+
| `context` | Adjust scale for the medium | `notebook`, `presentation`, `minimal`, `high-vis` |
|
|
290
|
+
| `rendering` | Control LaTeX and grid rendering | `no-latex`, `grid`, `latex-sans`, `pgf` |
|
|
291
|
+
| `plot-type` | Optimise for a chart type | `bar`, `scatter` |
|
|
292
|
+
| `script` | Non-Latin font support | `cjk-simplified`, `russian`, `turkish` |
|
|
293
|
+
|
|
294
|
+
```python
|
|
295
|
+
# List all available overlays
|
|
296
|
+
plotstyle.list_overlays()
|
|
297
|
+
plotstyle.list_overlays(category="context")
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
```text
|
|
301
|
+
# plotstyle.list_overlays()
|
|
302
|
+
['bar', 'cjk-japanese', 'cjk-korean', 'cjk-simplified', 'cjk-traditional', 'grid',
|
|
303
|
+
'high-vis', 'latex-sans', 'minimal', 'no-latex', 'notebook', 'okabe-ito', 'pgf',
|
|
304
|
+
'presentation', 'russian', 'safe-grayscale', 'scatter', 'tol-bright',
|
|
305
|
+
'tol-high-contrast', 'tol-light', 'tol-muted', 'tol-rainbow-10', 'tol-rainbow-12',
|
|
306
|
+
'tol-rainbow-4', 'tol-rainbow-6', 'tol-rainbow-8', 'tol-vibrant', 'turkish']
|
|
307
|
+
|
|
308
|
+
# plotstyle.list_overlays(category="context")
|
|
309
|
+
['high-vis', 'minimal', 'notebook', 'presentation']
|
|
310
|
+
```
|
|
311
|
+
|
|
231
312
|
---
|
|
232
313
|
|
|
233
314
|
### Colorblind and grayscale previews
|
|
@@ -248,21 +329,21 @@ with plotstyle.use("nature") as style:
|
|
|
248
329
|
ax.set_ylabel("Signal")
|
|
249
330
|
ax.legend()
|
|
250
331
|
|
|
332
|
+
# Simulate colour vision deficiency (deuteranopia, protanopia, tritanopia)
|
|
251
333
|
cvd_fig = plotstyle.preview_colorblind(fig)
|
|
252
334
|
cvd_fig.savefig("accessibility_colorblind.png", dpi=150, bbox_inches="tight")
|
|
253
|
-
```
|
|
254
335
|
|
|
255
|
-
|
|
256
|
-
<img src="examples/output/accessibility_colorblind.png" width="90%" alt="Colorblind simulation: original, deuteranopia, protanopia, tritanopia">
|
|
257
|
-
</p>
|
|
258
|
-
|
|
259
|
-
```python
|
|
336
|
+
# Simulate grayscale print
|
|
260
337
|
gray_fig = plotstyle.preview_grayscale(fig)
|
|
261
338
|
gray_fig.savefig("accessibility_grayscale.png", dpi=150, bbox_inches="tight")
|
|
262
339
|
```
|
|
263
340
|
|
|
264
341
|
<p align="center">
|
|
265
|
-
<img src="examples/output/
|
|
342
|
+
<img src="https://raw.githubusercontent.com/rahulkaushal04/plotstyle/main/examples/output/accessibility_colorblind.png" width="90%" alt="Colorblind simulation: original, deuteranopia, protanopia, tritanopia">
|
|
343
|
+
</p>
|
|
344
|
+
|
|
345
|
+
<p align="center">
|
|
346
|
+
<img src="https://raw.githubusercontent.com/rahulkaushal04/plotstyle/main/examples/output/accessibility_grayscale.png" width="60%" alt="Grayscale simulation: original vs grayscale rendering">
|
|
266
347
|
</p>
|
|
267
348
|
|
|
268
349
|
---
|
|
@@ -281,6 +362,46 @@ for failure in report.failures:
|
|
|
281
362
|
print(failure.fix_suggestion) # how to fix it
|
|
282
363
|
```
|
|
283
364
|
|
|
365
|
+
```text
|
|
366
|
+
┌──────────────────────────────────────────────────────┐
|
|
367
|
+
│ PlotStyle Validation Report — Nature │
|
|
368
|
+
├──────────┬───────────────────────────────────────────┤
|
|
369
|
+
│ ✓ PASS │ Figure width 89.0mm matches single colu...│
|
|
370
|
+
│ ✓ PASS │ Figure height 55.0mm is within the Natu...│
|
|
371
|
+
│ ✗ FAIL │ pdf.fonttype = 3; must be 42 for TrueTy...│
|
|
372
|
+
│ ✗ FAIL │ ps.fonttype = 3; must be 42 for TrueTyp...│
|
|
373
|
+
│ ⚠ WARN │ savefig.dpi = 'figure'; Nature requires...│
|
|
374
|
+
│ ✓ PASS │ All plotted lines and spines meet the N...│
|
|
375
|
+
│ ✗ FAIL │ 14 text element(s) outside the Nature r...│
|
|
376
|
+
└──────────┴───────────────────────────────────────────┘
|
|
377
|
+
3/7 checks passed, 1 warning(s), 3 failure(s)
|
|
378
|
+
|
|
379
|
+
passed: False
|
|
380
|
+
|
|
381
|
+
failure.message: pdf.fonttype = 3; must be 42 for TrueType font embedding.
|
|
382
|
+
failure.fix_suggestion: Call plotstyle.use() to apply all required rcParams, or set
|
|
383
|
+
mpl.rcParams['pdf.fonttype'] = 42 manually.
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
When called inside `plotstyle.use()`, all checks pass:
|
|
387
|
+
|
|
388
|
+
```text
|
|
389
|
+
┌──────────────────────────────────────────────────────┐
|
|
390
|
+
│ PlotStyle Validation Report — Nature │
|
|
391
|
+
├──────────┬───────────────────────────────────────────┤
|
|
392
|
+
│ ✓ PASS │ Figure width 89.0mm matches single colu...│
|
|
393
|
+
│ ✓ PASS │ Figure height 55.0mm is within the Natu...│
|
|
394
|
+
│ ✓ PASS │ pdf.fonttype = 42 (TrueType fonts will ...│
|
|
395
|
+
│ ✓ PASS │ ps.fonttype = 42 (TrueType fonts will b...│
|
|
396
|
+
│ ✓ PASS │ savefig.dpi = 300.0 meets the Nature mi...│
|
|
397
|
+
│ ✓ PASS │ All plotted lines and spines meet the N...│
|
|
398
|
+
│ ✓ PASS │ All text elements are within the Nature...│
|
|
399
|
+
└──────────┴───────────────────────────────────────────┘
|
|
400
|
+
7/7 checks passed, 0 warning(s), 0 failure(s)
|
|
401
|
+
|
|
402
|
+
passed: True
|
|
403
|
+
```
|
|
404
|
+
|
|
284
405
|
```python
|
|
285
406
|
paths = plotstyle.export_submission(
|
|
286
407
|
fig,
|
|
@@ -289,7 +410,14 @@ paths = plotstyle.export_submission(
|
|
|
289
410
|
author_surname="Smith", # IEEE prepends the surname prefix to filenames
|
|
290
411
|
output_dir="submission/",
|
|
291
412
|
)
|
|
292
|
-
|
|
413
|
+
print(paths)
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
```text
|
|
417
|
+
[PosixPath('submission/smith_figure1.tiff'),
|
|
418
|
+
PosixPath('submission/smith_figure1.eps'),
|
|
419
|
+
PosixPath('submission/smith_figure1.pdf'),
|
|
420
|
+
PosixPath('submission/smith_figure1.png')]
|
|
293
421
|
```
|
|
294
422
|
|
|
295
423
|
---
|
|
@@ -320,10 +448,109 @@ plotstyle list # list all journal presets
|
|
|
320
448
|
plotstyle info <journal> # show spec details
|
|
321
449
|
plotstyle diff <journal_a> <journal_b> # compare two journals
|
|
322
450
|
plotstyle fonts --journal <journal> # check font availability
|
|
451
|
+
plotstyle overlays [--category <category>] # list available overlays
|
|
452
|
+
plotstyle overlay-info <overlay> # show overlay details
|
|
323
453
|
plotstyle validate <file> --journal <journal> # validate a saved figure
|
|
324
454
|
plotstyle export <file> --journal <journal> # print snippet for re-exporting
|
|
325
455
|
```
|
|
326
456
|
|
|
457
|
+
**`plotstyle list`**
|
|
458
|
+
```text
|
|
459
|
+
acs American Chemical Society
|
|
460
|
+
cell Cell Press
|
|
461
|
+
elsevier Elsevier
|
|
462
|
+
ieee IEEE
|
|
463
|
+
nature Springer Nature
|
|
464
|
+
plos Public Library of Science
|
|
465
|
+
prl American Physical Society
|
|
466
|
+
science AAAS
|
|
467
|
+
springer Springer Nature
|
|
468
|
+
wiley Wiley
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
**`plotstyle info nature`**
|
|
472
|
+
```text
|
|
473
|
+
Journal: Nature
|
|
474
|
+
Publisher: Springer Nature
|
|
475
|
+
Source: https://www.nature.com/documents/nature-final-artwork.pdf
|
|
476
|
+
Last Verified: 2026-04-22
|
|
477
|
+
──────────────────────────
|
|
478
|
+
Dimensions:
|
|
479
|
+
Single column: 89.0mm (3.50in)
|
|
480
|
+
Double column: 183.0mm (7.20in)
|
|
481
|
+
Max height: 247.0mm
|
|
482
|
+
Typography:
|
|
483
|
+
Font: Helvetica, Arial (fallback: sans-serif)
|
|
484
|
+
Size range: 5.0-7.0pt
|
|
485
|
+
Panel labels: 5.0pt bold lower (a, b, c)
|
|
486
|
+
Export:
|
|
487
|
+
Formats: ai, eps, pdf
|
|
488
|
+
Min DPI: 300
|
|
489
|
+
Color: rgb
|
|
490
|
+
Accessibility:
|
|
491
|
+
Colorblind safe: Not required
|
|
492
|
+
Grayscale safe: Not required
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**`plotstyle diff nature science`**
|
|
496
|
+
```text
|
|
497
|
+
Nature → Science
|
|
498
|
+
──────────────────────────────────────────────────
|
|
499
|
+
Column Width (single): 89.0mm → 86.4mm
|
|
500
|
+
Column Width (double): 183.0mm → 177.8mm
|
|
501
|
+
Max Height: 247.0mm → —
|
|
502
|
+
Font Family: Helvetica, Arial → Minion Pro, Benton Sans Condensed
|
|
503
|
+
Min Font Size: 5.0pt → 7.5pt
|
|
504
|
+
Max Font Size: 7.0pt → 10.0pt
|
|
505
|
+
Panel Label Size: 5.0pt → 7.5pt
|
|
506
|
+
Preferred Formats: ai, eps, pdf → ai, eps, pdf, tiff
|
|
507
|
+
Colorblind Required: No → Yes
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
**`plotstyle fonts --journal nature`**
|
|
511
|
+
```text
|
|
512
|
+
Font check for: Nature
|
|
513
|
+
Required: Helvetica, Arial
|
|
514
|
+
Available: Helvetica, Arial
|
|
515
|
+
Selected: Helvetica
|
|
516
|
+
Exact match: Yes
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
**`plotstyle overlays`**
|
|
520
|
+
```text
|
|
521
|
+
bar [plot-type] Optimised rcParams for bar charts.
|
|
522
|
+
cjk-simplified [script] Font configuration for Simplified Chinese labels.
|
|
523
|
+
grid [rendering] Enable major grid lines with a subtle dashed style.
|
|
524
|
+
high-vis [context] Maximum contrast, bold lines, and oversized ticks.
|
|
525
|
+
latex-sans [rendering] Enable LaTeX rendering with a sans-serif font family.
|
|
526
|
+
minimal [context] Stripped-down axes with no top/right spines.
|
|
527
|
+
no-latex [rendering] Disable LaTeX text rendering; use Matplotlib MathText.
|
|
528
|
+
notebook [context] Enlarged figures and larger fonts for Jupyter.
|
|
529
|
+
okabe-ito [color] Colorblind-safe 8-color qualitative palette.
|
|
530
|
+
pgf [rendering] Use the PGF LaTeX backend for vector output.
|
|
531
|
+
presentation [context] Large text and thick lines for slide decks.
|
|
532
|
+
safe-grayscale [color] 6-step grayscale palette for black-and-white print.
|
|
533
|
+
scatter [plot-type] Optimised rcParams for scatter plots.
|
|
534
|
+
tol-bright [color] Paul Tol's bright 7-color qualitative palette.
|
|
535
|
+
...
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
**`plotstyle overlay-info minimal`**
|
|
539
|
+
```text
|
|
540
|
+
Overlay: Minimal
|
|
541
|
+
Key: minimal
|
|
542
|
+
Category: context
|
|
543
|
+
Description: Stripped-down axes with no top/right spines for editorial and blog use.
|
|
544
|
+
──────────────────────────
|
|
545
|
+
rcParams:
|
|
546
|
+
axes.spines.top = False
|
|
547
|
+
axes.spines.right = False
|
|
548
|
+
xtick.top = False
|
|
549
|
+
ytick.right = False
|
|
550
|
+
axes.grid = False
|
|
551
|
+
axes.linewidth = 0.8
|
|
552
|
+
```
|
|
553
|
+
|
|
327
554
|
---
|
|
328
555
|
|
|
329
556
|
## Documentation
|
|
@@ -356,7 +583,7 @@ If PlotStyle helps your research, a citation or star is appreciated:
|
|
|
356
583
|
title = {PlotStyle: Publication-ready scientific figure presets for Matplotlib},
|
|
357
584
|
year = {2026},
|
|
358
585
|
url = {https://github.com/rahulkaushal04/plotstyle},
|
|
359
|
-
note = {Version 1.
|
|
586
|
+
note = {Version 1.2.0},
|
|
360
587
|
}
|
|
361
588
|
```
|
|
362
589
|
|