scidraw-ai 0.1.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.
@@ -0,0 +1,6 @@
1
+ dist/
2
+ build/
3
+ *.egg-info/
4
+ __pycache__/
5
+ *.pyc
6
+ .venv/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SciDraw AI (sci-draw.com)
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,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: scidraw-ai
3
+ Version: 0.1.0
4
+ Summary: Publication-ready matplotlib styles and figure helpers by SciDraw AI — colorblind-safe palettes, journal figure sizes, and panel labels for Nature, Science, Cell, PLOS, and ACS.
5
+ Project-URL: Homepage, https://sci-draw.com
6
+ Project-URL: Documentation, https://sci-draw.com/tools
7
+ Project-URL: Chart Maker, https://sci-draw.com/scientific-figure-maker
8
+ Author-email: SciDraw AI <davie@daviechen.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: colorblind,figures,journal,matplotlib,okabe-ito,publication,scientific,styles,visualization
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: Matplotlib
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Visualization
23
+ Requires-Python: >=3.9
24
+ Requires-Dist: matplotlib>=3.5
25
+ Description-Content-Type: text/markdown
26
+
27
+ # scidraw-ai
28
+
29
+ Publication-ready matplotlib styles and figure helpers, maintained by
30
+ [SciDraw AI](https://sci-draw.com) — the AI scientific illustration and
31
+ data visualization platform.
32
+
33
+ The color cycles and journal specs in this package are the same ones used
34
+ by the [SciDraw AI chart tools](https://sci-draw.com/tools), so Python code
35
+ exported from the platform reproduces identically on your machine.
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ pip install scidraw-ai
41
+ ```
42
+
43
+ ## Quick start
44
+
45
+ ```python
46
+ import matplotlib.pyplot as plt
47
+ import scidraw_ai # registers the styles
48
+
49
+ plt.style.use('scidraw') # publication (light)
50
+ plt.style.use('scidraw-dark') # slides & screens
51
+ plt.style.use(['scidraw', 'scidraw-poster']) # posters & talks
52
+ ```
53
+
54
+ The `scidraw` style gives you:
55
+
56
+ - **Okabe-Ito colorblind-safe color cycle** — the standard recommended for
57
+ scientific publishing (pair the yellow with distinct markers on white
58
+ backgrounds)
59
+ - Clean axes: no top/right spines, outward ticks, frameless legends
60
+ - Journal-friendly type sizes (7–9 pt) with Arial/Helvetica preferred
61
+ - 300 DPI tight-bbox saving out of the box
62
+ - **Editable text in exports** — `pdf.fonttype 42` / `svg.fonttype none`,
63
+ so labels stay editable in Illustrator, Inkscape, or PowerPoint
64
+
65
+ ## Journal figure sizes
66
+
67
+ Widths follow each journal's author guidelines (Nature, Science, Cell,
68
+ PLOS, ACS):
69
+
70
+ ```python
71
+ fig, ax = plt.subplots(figsize=scidraw_ai.figsize('nature', 'single'))
72
+ fig, ax = plt.subplots(figsize=scidraw_ai.figsize('science', 'double'))
73
+ ```
74
+
75
+ ## Panel labels
76
+
77
+ Each journal formats panel labels differently — Nature wants bold
78
+ lowercase `a`, Science wants `(A)`, PLOS wants `A.`:
79
+
80
+ ```python
81
+ fig, axs = plt.subplots(1, 3)
82
+ scidraw_ai.label_panels(axs, journal='nature')
83
+ ```
84
+
85
+ ## Palettes
86
+
87
+ Four colorblind-safe palettes, identical to the SciDraw AI platform:
88
+
89
+ ```python
90
+ scidraw_ai.set_palette('okabe-ito') # default
91
+ scidraw_ai.set_palette('wong')
92
+ scidraw_ai.set_palette('tol-bright')
93
+ scidraw_ai.set_palette('tol-muted')
94
+ ```
95
+
96
+ ## Generate figures from data, no code
97
+
98
+ Prefer not to write plotting code at all? [SciDraw AI](https://sci-draw.com)
99
+ turns CSV/Excel data into journal-quality charts — box plots, heatmaps,
100
+ regression and violin plots — and exports editable SVG/PDF plus the
101
+ matplotlib code to reproduce them:
102
+
103
+ - [Scientific figure maker](https://sci-draw.com/scientific-figure-maker)
104
+ - [Free scientific diagram & chart tools](https://sci-draw.com/tools)
105
+
106
+ ## License
107
+
108
+ MIT
@@ -0,0 +1,82 @@
1
+ # scidraw-ai
2
+
3
+ Publication-ready matplotlib styles and figure helpers, maintained by
4
+ [SciDraw AI](https://sci-draw.com) — the AI scientific illustration and
5
+ data visualization platform.
6
+
7
+ The color cycles and journal specs in this package are the same ones used
8
+ by the [SciDraw AI chart tools](https://sci-draw.com/tools), so Python code
9
+ exported from the platform reproduces identically on your machine.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install scidraw-ai
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ ```python
20
+ import matplotlib.pyplot as plt
21
+ import scidraw_ai # registers the styles
22
+
23
+ plt.style.use('scidraw') # publication (light)
24
+ plt.style.use('scidraw-dark') # slides & screens
25
+ plt.style.use(['scidraw', 'scidraw-poster']) # posters & talks
26
+ ```
27
+
28
+ The `scidraw` style gives you:
29
+
30
+ - **Okabe-Ito colorblind-safe color cycle** — the standard recommended for
31
+ scientific publishing (pair the yellow with distinct markers on white
32
+ backgrounds)
33
+ - Clean axes: no top/right spines, outward ticks, frameless legends
34
+ - Journal-friendly type sizes (7–9 pt) with Arial/Helvetica preferred
35
+ - 300 DPI tight-bbox saving out of the box
36
+ - **Editable text in exports** — `pdf.fonttype 42` / `svg.fonttype none`,
37
+ so labels stay editable in Illustrator, Inkscape, or PowerPoint
38
+
39
+ ## Journal figure sizes
40
+
41
+ Widths follow each journal's author guidelines (Nature, Science, Cell,
42
+ PLOS, ACS):
43
+
44
+ ```python
45
+ fig, ax = plt.subplots(figsize=scidraw_ai.figsize('nature', 'single'))
46
+ fig, ax = plt.subplots(figsize=scidraw_ai.figsize('science', 'double'))
47
+ ```
48
+
49
+ ## Panel labels
50
+
51
+ Each journal formats panel labels differently — Nature wants bold
52
+ lowercase `a`, Science wants `(A)`, PLOS wants `A.`:
53
+
54
+ ```python
55
+ fig, axs = plt.subplots(1, 3)
56
+ scidraw_ai.label_panels(axs, journal='nature')
57
+ ```
58
+
59
+ ## Palettes
60
+
61
+ Four colorblind-safe palettes, identical to the SciDraw AI platform:
62
+
63
+ ```python
64
+ scidraw_ai.set_palette('okabe-ito') # default
65
+ scidraw_ai.set_palette('wong')
66
+ scidraw_ai.set_palette('tol-bright')
67
+ scidraw_ai.set_palette('tol-muted')
68
+ ```
69
+
70
+ ## Generate figures from data, no code
71
+
72
+ Prefer not to write plotting code at all? [SciDraw AI](https://sci-draw.com)
73
+ turns CSV/Excel data into journal-quality charts — box plots, heatmaps,
74
+ regression and violin plots — and exports editable SVG/PDF plus the
75
+ matplotlib code to reproduce them:
76
+
77
+ - [Scientific figure maker](https://sci-draw.com/scientific-figure-maker)
78
+ - [Free scientific diagram & chart tools](https://sci-draw.com/tools)
79
+
80
+ ## License
81
+
82
+ MIT
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "scidraw-ai"
7
+ version = "0.1.0"
8
+ description = "Publication-ready matplotlib styles and figure helpers by SciDraw AI — colorblind-safe palettes, journal figure sizes, and panel labels for Nature, Science, Cell, PLOS, and ACS."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "SciDraw AI", email = "davie@daviechen.com" }]
13
+ keywords = [
14
+ "matplotlib",
15
+ "styles",
16
+ "scientific",
17
+ "publication",
18
+ "figures",
19
+ "colorblind",
20
+ "okabe-ito",
21
+ "journal",
22
+ "visualization",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: Science/Research",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.9",
30
+ "Programming Language :: Python :: 3.10",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Topic :: Scientific/Engineering :: Visualization",
35
+ "Framework :: Matplotlib",
36
+ ]
37
+ dependencies = ["matplotlib>=3.5"]
38
+
39
+ [project.urls]
40
+ Homepage = "https://sci-draw.com"
41
+ Documentation = "https://sci-draw.com/tools"
42
+ "Chart Maker" = "https://sci-draw.com/scientific-figure-maker"
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["src/scidraw_ai"]
@@ -0,0 +1,146 @@
1
+ """SciDraw AI — publication-ready matplotlib styles and figure helpers.
2
+
3
+ Official companion package for `SciDraw AI <https://sci-draw.com>`_.
4
+ Importing this package registers three matplotlib styles::
5
+
6
+ import matplotlib.pyplot as plt
7
+ import scidraw_ai # noqa: F401 (registers styles)
8
+
9
+ plt.style.use('scidraw') # publication (light)
10
+ plt.style.use('scidraw-dark') # slides / screens
11
+ plt.style.use(['scidraw', 'scidraw-poster']) # posters & talks
12
+
13
+ The color cycles and journal specs match the figures generated by the
14
+ SciDraw AI chart tools at https://sci-draw.com/tools, so code exported
15
+ from the platform reproduces identically with this package installed.
16
+ """
17
+
18
+ from pathlib import Path
19
+
20
+ import matplotlib
21
+ import matplotlib.style
22
+
23
+ __version__ = '0.1.0'
24
+
25
+ __all__ = [
26
+ 'PALETTES',
27
+ 'JOURNALS',
28
+ 'set_palette',
29
+ 'figsize',
30
+ 'label_panels',
31
+ ]
32
+
33
+ _STYLE_DIR = Path(__file__).parent / 'styles'
34
+
35
+ #: Colorblind-safe palettes, identical to the ones used by SciDraw AI
36
+ #: chart generation (https://sci-draw.com/tools).
37
+ PALETTES = {
38
+ 'okabe-ito': [
39
+ '#E69F00', '#56B4E9', '#009E73', '#F0E442',
40
+ '#0072B2', '#D55E00', '#CC79A7', '#000000',
41
+ ],
42
+ 'wong': [
43
+ '#000000', '#E69F00', '#56B4E9', '#009E73',
44
+ '#F0E442', '#0072B2', '#D55E00', '#CC79A7',
45
+ ],
46
+ 'tol-bright': [
47
+ '#4477AA', '#EE6677', '#228833', '#CCBB44',
48
+ '#66CCEE', '#AA3377', '#BBBBBB',
49
+ ],
50
+ 'tol-muted': [
51
+ '#332288', '#88CCEE', '#44AA99', '#117733', '#999933',
52
+ '#DDCC77', '#CC6677', '#882255', '#AA4499',
53
+ ],
54
+ }
55
+
56
+ #: Journal figure widths in inches (single / double column) and panel
57
+ #: label conventions, following each journal's author guidelines.
58
+ JOURNALS = {
59
+ 'nature': {'single': 3.50, 'double': 7.20, 'label': '{a}'},
60
+ 'science': {'single': 2.17, 'double': 6.89, 'label': '({A})'},
61
+ 'cell': {'single': 3.35, 'double': 7.01, 'label': '{A}'},
62
+ 'plos': {'single': 3.27, 'double': 6.81, 'label': '{A}.'},
63
+ 'acs': {'single': 3.25, 'double': 7.00, 'label': '({a})'},
64
+ }
65
+
66
+
67
+ def _register_styles():
68
+ for path in sorted(_STYLE_DIR.glob('*.mplstyle')):
69
+ style = matplotlib.rc_params_from_file(
70
+ path, use_default_template=False
71
+ )
72
+ matplotlib.style.library[path.stem] = style
73
+ matplotlib.style.core.available[:] = sorted(matplotlib.style.library)
74
+
75
+
76
+ def set_palette(name='okabe-ito'):
77
+ """Set the active color cycle to one of :data:`PALETTES`.
78
+
79
+ >>> import scidraw_ai
80
+ >>> scidraw_ai.set_palette('tol-bright')
81
+ """
82
+ try:
83
+ colors = PALETTES[name]
84
+ except KeyError:
85
+ raise ValueError(
86
+ f'Unknown palette {name!r}. '
87
+ f'Available: {", ".join(sorted(PALETTES))}'
88
+ ) from None
89
+ matplotlib.rcParams['axes.prop_cycle'] = matplotlib.cycler(color=colors)
90
+ return colors
91
+
92
+
93
+ def figsize(journal='nature', columns='single', aspect=0.75):
94
+ """Return ``(width, height)`` in inches for a journal figure.
95
+
96
+ ``journal`` is one of :data:`JOURNALS`; ``columns`` is ``'single'``
97
+ or ``'double'``; ``aspect`` is height/width (default 3:4).
98
+
99
+ >>> import matplotlib.pyplot as plt, scidraw_ai
100
+ >>> fig, ax = plt.subplots(figsize=scidraw_ai.figsize('nature'))
101
+ """
102
+ try:
103
+ spec = JOURNALS[journal]
104
+ except KeyError:
105
+ raise ValueError(
106
+ f'Unknown journal {journal!r}. '
107
+ f'Available: {", ".join(sorted(JOURNALS))}'
108
+ ) from None
109
+ if columns not in ('single', 'double'):
110
+ raise ValueError("columns must be 'single' or 'double'")
111
+ width = spec[columns]
112
+ return (width, width * aspect)
113
+
114
+
115
+ def label_panels(axes, journal='nature', x=-0.12, y=1.05, **text_kwargs):
116
+ """Label panels a, b, c… following a journal's convention.
117
+
118
+ Nature: bold lowercase ``a``; Science: ``(A)``; Cell: ``A``;
119
+ PLOS: ``A.``; ACS: ``(a)``.
120
+
121
+ >>> fig, axs = plt.subplots(1, 3)
122
+ >>> scidraw_ai.label_panels(axs, journal='nature')
123
+ """
124
+ template = JOURNALS[journal]['label']
125
+ try:
126
+ flat = list(axes.flat)
127
+ except AttributeError:
128
+ flat = [axes] if not isinstance(axes, (list, tuple)) else list(axes)
129
+ kwargs = {
130
+ 'fontweight': 'bold',
131
+ 'fontsize': matplotlib.rcParams['axes.titlesize'],
132
+ 'va': 'bottom',
133
+ 'ha': 'right',
134
+ }
135
+ kwargs.update(text_kwargs)
136
+ labels = []
137
+ for i, ax in enumerate(flat):
138
+ letter = chr(ord('a') + i)
139
+ text = template.format(a=letter, A=letter.upper())
140
+ labels.append(
141
+ ax.text(x, y, text, transform=ax.transAxes, **kwargs)
142
+ )
143
+ return labels
144
+
145
+
146
+ _register_styles()
@@ -0,0 +1,61 @@
1
+ # scidraw-dark — dark style for slides & screens by SciDraw AI (https://sci-draw.com)
2
+ # Same Okabe-Ito cycle (black slot swapped for white), stepped for dark surfaces.
3
+
4
+ figure.figsize: 3.5, 2.625
5
+ figure.dpi: 110
6
+ figure.facecolor: 171717
7
+
8
+ savefig.dpi: 300
9
+ savefig.bbox: tight
10
+ savefig.pad_inches: 0.02
11
+ savefig.facecolor: 171717
12
+
13
+ font.family: sans-serif
14
+ font.sans-serif: Arial, Helvetica, DejaVu Sans
15
+ font.size: 8
16
+ mathtext.default: regular
17
+
18
+ text.color: e5e5e5
19
+
20
+ axes.titlesize: 9
21
+ axes.labelsize: 8
22
+ axes.linewidth: 0.8
23
+ axes.facecolor: 171717
24
+ axes.edgecolor: a3a3a3
25
+ axes.labelcolor: e5e5e5
26
+ axes.spines.top: False
27
+ axes.spines.right: False
28
+ axes.grid: False
29
+ axes.prop_cycle: cycler('color', ['E69F00', '56B4E9', '009E73', 'F0E442', '0072B2', 'D55E00', 'CC79A7', 'FFFFFF'])
30
+ axes.axisbelow: True
31
+
32
+ xtick.labelsize: 7
33
+ ytick.labelsize: 7
34
+ xtick.direction: out
35
+ ytick.direction: out
36
+ xtick.major.size: 3
37
+ ytick.major.size: 3
38
+ xtick.major.width: 0.8
39
+ ytick.major.width: 0.8
40
+ xtick.minor.size: 1.5
41
+ ytick.minor.size: 1.5
42
+ xtick.minor.width: 0.6
43
+ ytick.minor.width: 0.6
44
+ xtick.color: e5e5e5
45
+ ytick.color: e5e5e5
46
+
47
+ lines.linewidth: 1.5
48
+ lines.markersize: 4
49
+ errorbar.capsize: 2
50
+
51
+ grid.color: 333333
52
+ grid.linewidth: 0.5
53
+
54
+ legend.fontsize: 7
55
+ legend.title_fontsize: 8
56
+ legend.frameon: False
57
+ legend.handlelength: 1.5
58
+
59
+ pdf.fonttype: 42
60
+ ps.fonttype: 42
61
+ svg.fonttype: none
@@ -0,0 +1,25 @@
1
+ # scidraw-poster — size overrides for posters & talks by SciDraw AI (https://sci-draw.com)
2
+ # Compose on top of a base style: plt.style.use(['scidraw', 'scidraw-poster'])
3
+ # or plt.style.use(['scidraw-dark', 'scidraw-poster'])
4
+
5
+ figure.figsize: 7, 5.25
6
+
7
+ font.size: 14
8
+
9
+ axes.titlesize: 16
10
+ axes.labelsize: 14
11
+ axes.linewidth: 1.2
12
+
13
+ xtick.labelsize: 12
14
+ ytick.labelsize: 12
15
+ xtick.major.size: 5
16
+ ytick.major.size: 5
17
+ xtick.major.width: 1.2
18
+ ytick.major.width: 1.2
19
+
20
+ lines.linewidth: 2.5
21
+ lines.markersize: 7
22
+ errorbar.capsize: 3
23
+
24
+ legend.fontsize: 12
25
+ legend.title_fontsize: 14
@@ -0,0 +1,59 @@
1
+ # scidraw — publication-ready light style by SciDraw AI (https://sci-draw.com)
2
+ # Okabe-Ito colorblind-safe cycle, clean spines, journal-friendly type sizes.
3
+
4
+ figure.figsize: 3.5, 2.625
5
+ figure.dpi: 110
6
+ figure.facecolor: white
7
+
8
+ savefig.dpi: 300
9
+ savefig.bbox: tight
10
+ savefig.pad_inches: 0.02
11
+ savefig.facecolor: white
12
+
13
+ font.family: sans-serif
14
+ font.sans-serif: Arial, Helvetica, DejaVu Sans
15
+ font.size: 8
16
+ mathtext.default: regular
17
+
18
+ axes.titlesize: 9
19
+ axes.labelsize: 8
20
+ axes.linewidth: 0.8
21
+ axes.edgecolor: black
22
+ axes.labelcolor: black
23
+ axes.spines.top: False
24
+ axes.spines.right: False
25
+ axes.grid: False
26
+ axes.prop_cycle: cycler('color', ['E69F00', '56B4E9', '009E73', 'F0E442', '0072B2', 'D55E00', 'CC79A7', '000000'])
27
+ axes.axisbelow: True
28
+
29
+ xtick.labelsize: 7
30
+ ytick.labelsize: 7
31
+ xtick.direction: out
32
+ ytick.direction: out
33
+ xtick.major.size: 3
34
+ ytick.major.size: 3
35
+ xtick.major.width: 0.8
36
+ ytick.major.width: 0.8
37
+ xtick.minor.size: 1.5
38
+ ytick.minor.size: 1.5
39
+ xtick.minor.width: 0.6
40
+ ytick.minor.width: 0.6
41
+ xtick.color: black
42
+ ytick.color: black
43
+
44
+ lines.linewidth: 1.5
45
+ lines.markersize: 4
46
+ errorbar.capsize: 2
47
+
48
+ grid.color: e5e5e5
49
+ grid.linewidth: 0.5
50
+
51
+ legend.fontsize: 7
52
+ legend.title_fontsize: 8
53
+ legend.frameon: False
54
+ legend.handlelength: 1.5
55
+
56
+ # Keep text editable in Illustrator / Inkscape exports
57
+ pdf.fonttype: 42
58
+ ps.fonttype: 42
59
+ svg.fonttype: none