plotstyle 0.1.0a1__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-0.1.0a1/.gitignore +159 -0
- plotstyle-0.1.0a1/CHANGELOG.md +42 -0
- plotstyle-0.1.0a1/LICENSE +21 -0
- plotstyle-0.1.0a1/PKG-INFO +271 -0
- plotstyle-0.1.0a1/README.md +214 -0
- plotstyle-0.1.0a1/pyproject.toml +298 -0
- plotstyle-0.1.0a1/src/plotstyle/__init__.py +121 -0
- plotstyle-0.1.0a1/src/plotstyle/_utils/__init__.py +0 -0
- plotstyle-0.1.0a1/src/plotstyle/_utils/io.py +113 -0
- plotstyle-0.1.0a1/src/plotstyle/_utils/warnings.py +86 -0
- plotstyle-0.1.0a1/src/plotstyle/_version.py +24 -0
- plotstyle-0.1.0a1/src/plotstyle/cli/__init__.py +0 -0
- plotstyle-0.1.0a1/src/plotstyle/cli/main.py +553 -0
- plotstyle-0.1.0a1/src/plotstyle/color/__init__.py +42 -0
- plotstyle-0.1.0a1/src/plotstyle/color/_rendering.py +86 -0
- plotstyle-0.1.0a1/src/plotstyle/color/accessibility.py +286 -0
- plotstyle-0.1.0a1/src/plotstyle/color/data/okabe_ito.json +5 -0
- plotstyle-0.1.0a1/src/plotstyle/color/data/safe_grayscale.json +7 -0
- plotstyle-0.1.0a1/src/plotstyle/color/data/tol_bright.json +5 -0
- plotstyle-0.1.0a1/src/plotstyle/color/data/tol_muted.json +5 -0
- plotstyle-0.1.0a1/src/plotstyle/color/data/tol_vibrant.json +5 -0
- plotstyle-0.1.0a1/src/plotstyle/color/grayscale.py +284 -0
- plotstyle-0.1.0a1/src/plotstyle/color/palettes.py +259 -0
- plotstyle-0.1.0a1/src/plotstyle/core/__init__.py +0 -0
- plotstyle-0.1.0a1/src/plotstyle/core/export.py +418 -0
- plotstyle-0.1.0a1/src/plotstyle/core/figure.py +394 -0
- plotstyle-0.1.0a1/src/plotstyle/core/migrate.py +579 -0
- plotstyle-0.1.0a1/src/plotstyle/core/style.py +394 -0
- plotstyle-0.1.0a1/src/plotstyle/engine/__init__.py +0 -0
- plotstyle-0.1.0a1/src/plotstyle/engine/fonts.py +309 -0
- plotstyle-0.1.0a1/src/plotstyle/engine/latex.py +287 -0
- plotstyle-0.1.0a1/src/plotstyle/engine/rcparams.py +352 -0
- plotstyle-0.1.0a1/src/plotstyle/integrations/__init__.py +0 -0
- plotstyle-0.1.0a1/src/plotstyle/integrations/seaborn.py +305 -0
- plotstyle-0.1.0a1/src/plotstyle/preview/__init__.py +50 -0
- plotstyle-0.1.0a1/src/plotstyle/preview/gallery.py +337 -0
- plotstyle-0.1.0a1/src/plotstyle/preview/print_size.py +304 -0
- plotstyle-0.1.0a1/src/plotstyle/py.typed +0 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/__init__.py +304 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/_templates.toml +48 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/acs.toml +36 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/cell.toml +35 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/elsevier.toml +35 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/ieee.toml +35 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/nature.toml +35 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/plos.toml +35 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/prl.toml +35 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/schema.py +1095 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/science.toml +35 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/springer.toml +35 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/units.py +761 -0
- plotstyle-0.1.0a1/src/plotstyle/specs/wiley.toml +35 -0
- plotstyle-0.1.0a1/src/plotstyle/validation/__init__.py +94 -0
- plotstyle-0.1.0a1/src/plotstyle/validation/checks/__init__.py +95 -0
- plotstyle-0.1.0a1/src/plotstyle/validation/checks/_base.py +149 -0
- plotstyle-0.1.0a1/src/plotstyle/validation/checks/colors.py +394 -0
- plotstyle-0.1.0a1/src/plotstyle/validation/checks/dimensions.py +166 -0
- plotstyle-0.1.0a1/src/plotstyle/validation/checks/export.py +205 -0
- plotstyle-0.1.0a1/src/plotstyle/validation/checks/lines.py +147 -0
- plotstyle-0.1.0a1/src/plotstyle/validation/checks/typography.py +200 -0
- plotstyle-0.1.0a1/src/plotstyle/validation/report.py +293 -0
- plotstyle-0.1.0a1/tests/conftest.py +4 -0
- plotstyle-0.1.0a1/tests/test_core/test_export.py +733 -0
- plotstyle-0.1.0a1/tests/test_core/test_figure.py +654 -0
- plotstyle-0.1.0a1/tests/test_core/test_migrate.py +846 -0
- plotstyle-0.1.0a1/tests/test_engine/test_fonts.py +945 -0
- plotstyle-0.1.0a1/tests/test_engine/test_latex.py +600 -0
- plotstyle-0.1.0a1/tests/test_engine/test_rcparams.py +1085 -0
- plotstyle-0.1.0a1/tests/test_integrations/test_seaborn.py +655 -0
- plotstyle-0.1.0a1/tests/test_specs/test_registry.py +1278 -0
- plotstyle-0.1.0a1/tests/test_specs/test_schema.py +1580 -0
- plotstyle-0.1.0a1/tests/test_specs/test_units.py +1592 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# hatch-vcs generated
|
|
10
|
+
src/plotstyle/_version.py
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
.Python
|
|
14
|
+
build/
|
|
15
|
+
dist/
|
|
16
|
+
downloads/
|
|
17
|
+
eggs/
|
|
18
|
+
.eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# Installer logs
|
|
30
|
+
pip-log.txt
|
|
31
|
+
pip-delete-this-directory.txt
|
|
32
|
+
|
|
33
|
+
# Unit test / coverage reports
|
|
34
|
+
htmlcov/
|
|
35
|
+
.tox/
|
|
36
|
+
.nox/
|
|
37
|
+
.coverage
|
|
38
|
+
.coverage.*
|
|
39
|
+
.cache
|
|
40
|
+
pytest_cache/
|
|
41
|
+
nosetests.xml
|
|
42
|
+
coverage.xml
|
|
43
|
+
*.cover
|
|
44
|
+
*.py,cover
|
|
45
|
+
.hypothesis/
|
|
46
|
+
|
|
47
|
+
# Translations
|
|
48
|
+
*.mo
|
|
49
|
+
*.pot
|
|
50
|
+
|
|
51
|
+
# Django stuff
|
|
52
|
+
*.log
|
|
53
|
+
local_settings.py
|
|
54
|
+
db.sqlite3
|
|
55
|
+
db.sqlite3-journal
|
|
56
|
+
|
|
57
|
+
# Flask stuff
|
|
58
|
+
instance/
|
|
59
|
+
.webassets-cache
|
|
60
|
+
|
|
61
|
+
# Scrapy stuff
|
|
62
|
+
.scrapy
|
|
63
|
+
|
|
64
|
+
# Sphinx documentation
|
|
65
|
+
docs/_build/
|
|
66
|
+
|
|
67
|
+
# PyBuilder
|
|
68
|
+
.pybuilder/
|
|
69
|
+
target/
|
|
70
|
+
|
|
71
|
+
# Jupyter Notebook
|
|
72
|
+
.ipynb_checkpoints
|
|
73
|
+
|
|
74
|
+
# IPython
|
|
75
|
+
profile_default/
|
|
76
|
+
ipython_config.py
|
|
77
|
+
|
|
78
|
+
# pyenv
|
|
79
|
+
.python-version
|
|
80
|
+
|
|
81
|
+
# pipenv
|
|
82
|
+
Pipfile.lock
|
|
83
|
+
|
|
84
|
+
# poetry
|
|
85
|
+
poetry.lock
|
|
86
|
+
|
|
87
|
+
# virtual environments
|
|
88
|
+
.env
|
|
89
|
+
.venv
|
|
90
|
+
env/
|
|
91
|
+
venv/
|
|
92
|
+
ENV/
|
|
93
|
+
env.bak/
|
|
94
|
+
venv.bak/
|
|
95
|
+
|
|
96
|
+
# IDEs and editors
|
|
97
|
+
.vscode/
|
|
98
|
+
.idea/
|
|
99
|
+
*.swp
|
|
100
|
+
*.swo
|
|
101
|
+
*~
|
|
102
|
+
*.iml
|
|
103
|
+
|
|
104
|
+
# macOS
|
|
105
|
+
.DS_Store
|
|
106
|
+
|
|
107
|
+
# Windows
|
|
108
|
+
Thumbs.db
|
|
109
|
+
ehthumbs.db
|
|
110
|
+
Desktop.ini
|
|
111
|
+
|
|
112
|
+
# mypy
|
|
113
|
+
.mypy_cache/
|
|
114
|
+
.dmypy.json
|
|
115
|
+
dmypy.json
|
|
116
|
+
|
|
117
|
+
# pyright
|
|
118
|
+
.pyright/
|
|
119
|
+
|
|
120
|
+
# pylint
|
|
121
|
+
.pylint.d/
|
|
122
|
+
|
|
123
|
+
# Ruff
|
|
124
|
+
.ruff_cache/
|
|
125
|
+
|
|
126
|
+
# pytype
|
|
127
|
+
.pytype/
|
|
128
|
+
|
|
129
|
+
# profiling
|
|
130
|
+
.prof
|
|
131
|
+
|
|
132
|
+
# dotenv
|
|
133
|
+
.env.*
|
|
134
|
+
!.env.example
|
|
135
|
+
|
|
136
|
+
# logs
|
|
137
|
+
*.log
|
|
138
|
+
|
|
139
|
+
# local configs
|
|
140
|
+
*.local
|
|
141
|
+
|
|
142
|
+
# static analysis
|
|
143
|
+
.cache/
|
|
144
|
+
|
|
145
|
+
# coverage artifacts
|
|
146
|
+
coverage/
|
|
147
|
+
|
|
148
|
+
# build artifacts
|
|
149
|
+
*.spec
|
|
150
|
+
|
|
151
|
+
# celery beat schedule
|
|
152
|
+
celerybeat-schedule
|
|
153
|
+
|
|
154
|
+
# backup files
|
|
155
|
+
*.bak
|
|
156
|
+
*.tmp
|
|
157
|
+
|
|
158
|
+
# secrets (just in case)
|
|
159
|
+
secrets.json
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **plotstyle** will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [PEP 440](https://peps.python.org/pep-0440/) versioning.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
_Nothing yet._
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## [0.1.0a1] - 2026-04-07
|
|
17
|
+
|
|
18
|
+
First public alpha release.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **Core style engine** — `plotstyle.use()` applies journal presets to Matplotlib's `rcParams`; works as a context manager with automatic restoration on exit.
|
|
23
|
+
- **Figure helpers** — `plotstyle.figure()` and `plotstyle.subplots()` create correctly-sized figures at the exact column width and max height specified by each journal.
|
|
24
|
+
- **Auto panel labels** — multi-panel figures receive **(a)**, **(b)**, **(c)**, … labels placed according to the journal's style rules.
|
|
25
|
+
- **Colorblind-safe palettes** — built-in Okabe–Ito, Tol Bright, Tol Vibrant, Tol Muted, and Safe Grayscale palettes (`plotstyle.palette()`).
|
|
26
|
+
- **Accessibility previews** — `plotstyle.preview_colorblind()` simulates deuteranopia, protanopia, and tritanopia; `plotstyle.preview_grayscale()` previews grayscale rendering.
|
|
27
|
+
- **Pre-submission validation** — `plotstyle.validate()` checks dimensions, typography, line weights, color accessibility, and export settings against a target journal spec.
|
|
28
|
+
- **Submission-ready export** — `plotstyle.savefig()` saves with font embedding and DPI enforcement; `plotstyle.export_submission()` batch-exports to all formats a journal accepts.
|
|
29
|
+
- **Spec diffing & migration** — `plotstyle.diff()` compares two journal specs; `plotstyle.migrate()` re-targets a figure from one journal to another.
|
|
30
|
+
- **Seaborn integration** — `patch_seaborn()` / `plotstyle_theme()` ensure PlotStyle `rcParams` survive `sns.set_theme()` calls.
|
|
31
|
+
- **Gallery & print-size preview** — `plotstyle.gallery()` generates sample figures; `plotstyle.preview_print_size()` opens an interactive scaled preview window.
|
|
32
|
+
- **Journal spec registry** — programmatic access via `plotstyle.registry`; specs are TOML files validated by immutable, typed dataclasses.
|
|
33
|
+
- **CLI** — `plotstyle list`, `plotstyle info`, `plotstyle diff`, `plotstyle fonts`, `plotstyle validate`, and `plotstyle export` sub-commands.
|
|
34
|
+
- **10 journal presets** — ACS, Cell, Elsevier, IEEE, Nature, PLOS, PRL, Science, Springer, Wiley.
|
|
35
|
+
- **10 working examples** — quick start, multi-panel, palettes, accessibility, validation, export, diff/migrate, gallery, registry, context manager patterns.
|
|
36
|
+
- **Dynamic versioning** — version derived from git tags via `hatch-vcs` and `importlib.metadata`.
|
|
37
|
+
- **CI/CD pipeline** — GitHub Actions workflows for lint, type-check, test matrix, and automated PyPI release via OIDC Trusted Publishing.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
[Unreleased]: https://github.com/rahulkaushal04/plotstyle/compare/v0.1.0a1...HEAD
|
|
42
|
+
[0.1.0a1]: https://github.com/rahulkaushal04/plotstyle/releases/tag/v0.1.0a1
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rahul Kaushal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: plotstyle
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Matplotlib/seaborn style presets matching scientific journal requirements, with validation, export safety, and preview capabilities.
|
|
5
|
+
Project-URL: Homepage, https://github.com/rahulkaushal04/plotstyle
|
|
6
|
+
Project-URL: Documentation, https://plotstyle.readthedocs.io
|
|
7
|
+
Project-URL: Repository, https://github.com/rahulkaushal04/plotstyle
|
|
8
|
+
Project-URL: Issues, https://github.com/rahulkaushal04/plotstyle/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/rahulkaushal04/plotstyle/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Rahul Kaushal
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: figures,journal,matplotlib,plotting,publication,scientific,seaborn,style
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Requires-Dist: matplotlib<4,>=3.9
|
|
29
|
+
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
30
|
+
Provides-Extra: all
|
|
31
|
+
Requires-Dist: fonttools<5,>=4.55; extra == 'all'
|
|
32
|
+
Requires-Dist: pandas<3,>=2.2; extra == 'all'
|
|
33
|
+
Requires-Dist: pillow<13,>=11.0; extra == 'all'
|
|
34
|
+
Requires-Dist: seaborn<1,>=0.13.2; extra == 'all'
|
|
35
|
+
Provides-Extra: color
|
|
36
|
+
Requires-Dist: pillow<13,>=11.0; extra == 'color'
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: mypy<2,>=1.15; extra == 'dev'
|
|
39
|
+
Requires-Dist: pillow<13,>=11.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: pre-commit<5,>=4.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: pytest-cov<7,>=6.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: pytest-mpl<1,>=0.18; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest<10,>=8.3; extra == 'dev'
|
|
44
|
+
Requires-Dist: ruff<1,>=0.15; extra == 'dev'
|
|
45
|
+
Provides-Extra: docs
|
|
46
|
+
Requires-Dist: furo>=2025.9.19; extra == 'docs'
|
|
47
|
+
Requires-Dist: myst-parser<5,>=4.0; extra == 'docs'
|
|
48
|
+
Requires-Dist: sphinx-autodoc-typehints<4,>=3.0; extra == 'docs'
|
|
49
|
+
Requires-Dist: sphinx-copybutton<1,>=0.5; extra == 'docs'
|
|
50
|
+
Requires-Dist: sphinx<10,>=9.0; extra == 'docs'
|
|
51
|
+
Provides-Extra: fonttools
|
|
52
|
+
Requires-Dist: fonttools<5,>=4.55; extra == 'fonttools'
|
|
53
|
+
Provides-Extra: seaborn
|
|
54
|
+
Requires-Dist: pandas<3,>=2.2; extra == 'seaborn'
|
|
55
|
+
Requires-Dist: seaborn<1,>=0.13.2; extra == 'seaborn'
|
|
56
|
+
Description-Content-Type: text/markdown
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
<strong>plotstyle</strong>
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
<p align="center">
|
|
63
|
+
<em>Publication-ready scientific figures — one line of code.</em>
|
|
64
|
+
</p>
|
|
65
|
+
|
|
66
|
+
<p align="center">
|
|
67
|
+
<a href="https://pypi.org/project/plotstyle/"><img alt="PyPI" src="https://img.shields.io/pypi/v/plotstyle?color=blue"></a>
|
|
68
|
+
<a href="https://pypi.org/project/plotstyle/"><img alt="Python" src="https://img.shields.io/pypi/pyversions/plotstyle"></a>
|
|
69
|
+
<a href="https://github.com/rahulkaushal04/plotstyle/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/rahulkaushal04/plotstyle"></a>
|
|
70
|
+
<a href="https://github.com/rahulkaushal04/plotstyle/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/rahulkaushal04/plotstyle/ci.yml?label=CI"></a>
|
|
71
|
+
</p>
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
**PlotStyle** configures [Matplotlib](https://matplotlib.org/) (and optionally [Seaborn](https://seaborn.pydata.org/)) so your figures match the typographic, dimensional, and export requirements of major scientific journals — out of the box.
|
|
76
|
+
|
|
77
|
+
> **Current release:** `v0.1.0a1` (alpha)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Table of Contents
|
|
82
|
+
|
|
83
|
+
- [Features](#features)
|
|
84
|
+
- [Supported Journals](#supported-journals)
|
|
85
|
+
- [Installation](#installation)
|
|
86
|
+
- [Quick Start](#quick-start)
|
|
87
|
+
- [Usage](#usage)
|
|
88
|
+
- [CLI](#cli)
|
|
89
|
+
- [Examples](#examples)
|
|
90
|
+
- [Contributing](#contributing)
|
|
91
|
+
- [License](#license)
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Features
|
|
96
|
+
|
|
97
|
+
- **One-line journal presets** — `plotstyle.use("nature")` sets fonts, sizes, line widths, and export parameters via Matplotlib's `rcParams`.
|
|
98
|
+
- **Correctly-sized figures** — `plotstyle.figure()` / `plotstyle.subplots()` create figures at the exact column width and max height specified by each journal.
|
|
99
|
+
- **Auto panel labels** — multi-panel figures get **(a)**, **(b)**, **(c)**, … labels placed according to the journal's style rules.
|
|
100
|
+
- **Colorblind-safe palettes** — built-in Okabe–Ito, Tol Bright/Vibrant/Muted, and grayscale-safe palettes with optional markers and linestyles.
|
|
101
|
+
- **Accessibility previews** — simulate deuteranopia, protanopia, and tritanopia; preview grayscale rendering.
|
|
102
|
+
- **Pre-submission validation** — check figure dimensions, font sizes, line weights, color accessibility, and export settings against the target journal's spec.
|
|
103
|
+
- **Submission-ready export** — batch-export to all formats a journal accepts (PDF, EPS, TIFF, …) with font embedding and DPI enforcement.
|
|
104
|
+
- **Spec diffing & migration** — compare two journal specs side-by-side; migrate a figure from one journal to another.
|
|
105
|
+
- **Seaborn compatibility** — a monkey-patch layer ensures PlotStyle's `rcParams` survive `sns.set_theme()` calls.
|
|
106
|
+
- **Typed, schema-validated specs** — journal requirements are stored as TOML files validated by immutable dataclasses.
|
|
107
|
+
- **CLI** — `plotstyle list`, `plotstyle info`, `plotstyle validate`, and more — no Python script needed.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Supported Journals
|
|
112
|
+
|
|
113
|
+
| Key | Journal | Publisher |
|
|
114
|
+
|-----|---------|-----------|
|
|
115
|
+
| `acs` | ACS (JACS) | American Chemical Society |
|
|
116
|
+
| `cell` | Cell | Cell Press |
|
|
117
|
+
| `elsevier` | Elsevier | Elsevier |
|
|
118
|
+
| `ieee` | IEEE Transactions | IEEE |
|
|
119
|
+
| `nature` | Nature | Springer Nature |
|
|
120
|
+
| `plos` | PLOS ONE | Public Library of Science |
|
|
121
|
+
| `prl` | Physical Review Letters | American Physical Society |
|
|
122
|
+
| `science` | Science | AAAS |
|
|
123
|
+
| `springer` | Springer | Springer |
|
|
124
|
+
| `wiley` | Wiley | Wiley |
|
|
125
|
+
|
|
126
|
+
> Need another journal? See [CONTRIBUTING.md](CONTRIBUTING.md) for how to add one.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Installation
|
|
131
|
+
|
|
132
|
+
Requires **Python 3.10+**.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pip install plotstyle
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Extras
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Colorblind / grayscale preview (needs Pillow)
|
|
142
|
+
pip install "plotstyle[color]"
|
|
143
|
+
|
|
144
|
+
# Font subsetting / inspection
|
|
145
|
+
pip install "plotstyle[fonttools]"
|
|
146
|
+
|
|
147
|
+
# Seaborn integration
|
|
148
|
+
pip install "plotstyle[seaborn]"
|
|
149
|
+
|
|
150
|
+
# Everything
|
|
151
|
+
pip install "plotstyle[all]"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Development install
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
git clone https://github.com/rahulkaushal04/plotstyle.git
|
|
158
|
+
cd plotstyle
|
|
159
|
+
pip install -e ".[dev]"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Quick Start
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
import numpy as np
|
|
168
|
+
import plotstyle
|
|
169
|
+
|
|
170
|
+
with plotstyle.use("nature"):
|
|
171
|
+
fig, ax = plotstyle.figure("nature", columns=1)
|
|
172
|
+
|
|
173
|
+
x = np.linspace(0, 2 * np.pi, 200)
|
|
174
|
+
ax.plot(x, np.sin(x), label="sin(x)")
|
|
175
|
+
ax.plot(x, np.cos(x), label="cos(x)")
|
|
176
|
+
ax.set_xlabel("Phase (rad)")
|
|
177
|
+
ax.set_ylabel("Amplitude (a.u.)")
|
|
178
|
+
ax.legend()
|
|
179
|
+
|
|
180
|
+
plotstyle.savefig(fig, "quickstart_nature.pdf", journal="nature")
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
`plotstyle.use()` also works as a context manager — `rcParams` are automatically restored on exit:
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
with plotstyle.use("ieee"):
|
|
187
|
+
fig, ax = plotstyle.figure("ieee", columns=1)
|
|
188
|
+
ax.plot([1, 2, 3])
|
|
189
|
+
plotstyle.savefig(fig, "fig_ieee.eps", journal="ieee")
|
|
190
|
+
# rcParams are back to normal here
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Usage
|
|
196
|
+
|
|
197
|
+
**Multi-panel figures** with auto labels:
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
fig, axes = plotstyle.subplots("science", nrows=2, ncols=2, columns=2)
|
|
201
|
+
# Axes get (a), (b), (c), (d) labels per journal style
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Colorblind-safe palettes** (Okabe–Ito, Tol Bright/Vibrant/Muted, Safe Grayscale):
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
colors = plotstyle.palette("nature", n=4)
|
|
208
|
+
styled = plotstyle.palette("ieee", n=3, with_markers=True) # [(color, linestyle, marker), ...]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Validation** — check dimensions, fonts, line weights, colors, and export settings:
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
report = plotstyle.validate(fig, journal="nature")
|
|
215
|
+
print(report.passed) # True / False
|
|
216
|
+
print(report.failures) # with fix suggestions
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Submission export** — batch-export to all formats a journal accepts:
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
plotstyle.export_submission(fig, "figure1", journal="ieee",
|
|
223
|
+
author_surname="Kaushal",
|
|
224
|
+
output_dir="submission_ieee")
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Accessibility previews**, **spec diffing & migration**, and **Seaborn integration** are also available — see the [`examples/`](examples/) directory for full usage.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## CLI
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
plotstyle list # List all journal presets
|
|
235
|
+
plotstyle info <journal> # Show spec details
|
|
236
|
+
plotstyle diff <journal_a> <journal_b> # Compare two journals
|
|
237
|
+
plotstyle fonts --journal <journal> # Check font availability
|
|
238
|
+
plotstyle validate <file> --journal <journal> # Validate a saved figure
|
|
239
|
+
plotstyle export <file> --journal <journal> # Re-export in required formats
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Examples
|
|
245
|
+
|
|
246
|
+
Working examples are in the [`examples/`](examples/) directory:
|
|
247
|
+
|
|
248
|
+
| # | File | Topic |
|
|
249
|
+
|---|------|-------|
|
|
250
|
+
| 01 | [01_quickstart.py](examples/01_quickstart.py) | Basic publication-ready figure |
|
|
251
|
+
| 02 | [02_multi_panel_figure.py](examples/02_multi_panel_figure.py) | 2×2 subplot grid with auto panel labels |
|
|
252
|
+
| 03 | [03_color_palettes.py](examples/03_color_palettes.py) | Journal-specific and universal palettes |
|
|
253
|
+
| 04 | [04_accessibility_checks.py](examples/04_accessibility_checks.py) | Colorblind and grayscale previews |
|
|
254
|
+
| 05 | [05_validation.py](examples/05_validation.py) | Pre-submission validation |
|
|
255
|
+
| 06 | [06_export_submission.py](examples/06_export_submission.py) | Batch submission export |
|
|
256
|
+
| 07 | [07_spec_diff_and_migrate.py](examples/07_spec_diff_and_migrate.py) | Spec comparison and figure migration |
|
|
257
|
+
| 08 | [08_gallery_preview.py](examples/08_gallery_preview.py) | Gallery preview generation |
|
|
258
|
+
| 09 | [09_registry_and_spec.py](examples/09_registry_and_spec.py) | Registry and spec access |
|
|
259
|
+
| 10 | [10_context_manager_patterns.py](examples/10_context_manager_patterns.py) | Context manager usage patterns |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Contributing
|
|
264
|
+
|
|
265
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, adding journal specs, code style, and pull request guidelines.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## License
|
|
270
|
+
|
|
271
|
+
[MIT](LICENSE) © 2026 Rahul Kaushal
|