scistackplot 0.1.65__tar.gz → 0.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.
- {scistackplot-0.1.65 → scistackplot-0.2.0}/PKG-INFO +50 -13
- {scistackplot-0.1.65 → scistackplot-0.2.0}/README.md +47 -10
- {scistackplot-0.1.65 → scistackplot-0.2.0}/src/scistackplot/__init__.py +62 -29
- scistackplot-0.2.0/src/scistackplot/export/__init__.py +1 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/export}/codegen.py +637 -324
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/export}/custom.py +25 -25
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/export}/figure_file.py +3 -3
- scistackplot-0.1.65/src/scistackplot/export.py → scistackplot-0.2.0/src/scistackplot/export/plot_data.py +114 -20
- scistackplot-0.2.0/src/scistackplot/export/reduction_code.py +377 -0
- scistackplot-0.2.0/src/scistackplot/model/__init__.py +1 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/model}/capability.py +232 -38
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/model}/design.py +9 -2
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/model}/presets.py +21 -4
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/model}/restore.py +5 -5
- scistackplot-0.2.0/src/scistackplot/model/role_labels.py +74 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/model}/roles.py +252 -32
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/model}/shape.py +36 -4
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/model}/spec.py +186 -22
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/model}/table.py +65 -11
- scistackplot-0.2.0/src/scistackplot/reduce/__init__.py +1 -0
- scistackplot-0.2.0/src/scistackplot/reduce/bins.py +755 -0
- scistackplot-0.2.0/src/scistackplot/reduce/categorical.py +473 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/cell.py +53 -50
- scistackplot-0.2.0/src/scistackplot/reduce/chain.py +62 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/compare.py +15 -10
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/diffbars.py +10 -10
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/fits.py +2 -2
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/groups.py +39 -88
- scistackplot-0.2.0/src/scistackplot/reduce/kde.py +157 -0
- scistackplot-0.2.0/src/scistackplot/reduce/omissions.py +261 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/panels.py +1 -1
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/reducer.py +14 -14
- scistackplot-0.2.0/src/scistackplot/reduce/reduction.py +353 -0
- scistackplot-0.1.65/src/scistackplot/reduce.py → scistackplot-0.2.0/src/scistackplot/reduce/resolve.py +412 -72
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/resolved.py +54 -5
- scistackplot-0.2.0/src/scistackplot/reduce/rows.py +185 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/series_stats.py +8 -2
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/spaghetti.py +1 -1
- scistackplot-0.2.0/src/scistackplot/reduce/stacking.py +86 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/variants.py +15 -7
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/weights.py +1 -1
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/ylimits.py +40 -9
- {scistackplot-0.1.65 → scistackplot-0.2.0}/src/scistackplot/render/__init__.py +1 -1
- {scistackplot-0.1.65 → scistackplot-0.2.0}/src/scistackplot/render/base.py +139 -14
- {scistackplot-0.1.65 → scistackplot-0.2.0}/src/scistackplot/render/mpl.py +189 -36
- {scistackplot-0.1.65 → scistackplot-0.2.0}/src/scistackplot/render/plotly_.py +239 -29
- {scistackplot-0.1.65 → scistackplot-0.2.0}/src/scistackplot/sources/base.py +8 -8
- {scistackplot-0.1.65 → scistackplot-0.2.0}/src/scistackplot/sources/csv.py +1 -1
- {scistackplot-0.1.65 → scistackplot-0.2.0}/src/scistackplot/sources/frame.py +1 -1
- scistackplot-0.2.0/src/scistackplot/text/__init__.py +1 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/text}/aliases.py +5 -5
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/text}/autosize.py +3 -3
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/text}/colors.py +1 -1
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/text}/textsize.py +2 -2
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/text}/ticklabels.py +1 -1
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/text}/xaxis.py +1 -1
- scistackplot-0.1.65/src/scistackplot/bins.py +0 -367
- {scistackplot-0.1.65 → scistackplot-0.2.0}/.gitignore +0 -0
- {scistackplot-0.1.65 → scistackplot-0.2.0}/pyproject.toml +0 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/numeric.py +0 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/spread.py +0 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/reduce}/temporal.py +0 -0
- {scistackplot-0.1.65 → scistackplot-0.2.0}/src/scistackplot/sources/__init__.py +0 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/sources}/dedup.py +0 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/text}/figsize.py +0 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/text}/framesize.py +0 -0
- {scistackplot-0.1.65/src/scistackplot → scistackplot-0.2.0/src/scistackplot/text}/paper.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: scistackplot
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Spec-driven plotting for long-format scientific data — standalone, GUI-friendly
|
|
5
5
|
Author: SciStack Contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -20,8 +20,8 @@ Requires-Python: >=3.10
|
|
|
20
20
|
Requires-Dist: csv-stats>=0.5.0
|
|
21
21
|
Requires-Dist: numpy>=1.21
|
|
22
22
|
Requires-Dist: pandas>=1.5
|
|
23
|
-
Requires-Dist: scicanonicalhash==0.
|
|
24
|
-
Requires-Dist: scistacklog==0.
|
|
23
|
+
Requires-Dist: scicanonicalhash==0.2.0
|
|
24
|
+
Requires-Dist: scistacklog==0.2.0
|
|
25
25
|
Provides-Extra: dev
|
|
26
26
|
Requires-Dist: matplotlib>=3.6; extra == 'dev'
|
|
27
27
|
Requires-Dist: plotly>=5.0; extra == 'dev'
|
|
@@ -113,6 +113,7 @@ collapsed. That single rule produces both defaults and availability:
|
|
|
113
113
|
| scalar | scatter, or a bar with no error bar | box / violin / bar + CI |
|
|
114
114
|
| 1-D array | one line per leaf group | mean line + shaded error band |
|
|
115
115
|
| 2-D | heatmap | mean heatmap |
|
|
116
|
+
| text | count bar | proportion bar + error (see "Text measures") |
|
|
116
117
|
|
|
117
118
|
"Average over trials, then show the spread across subjects" is
|
|
118
119
|
`trial=COLLAPSE, subject=COLLAPSE`: trial averages within each subject
|
|
@@ -125,7 +126,7 @@ sessions inside their group. It needs two grouping layers, and the same list
|
|
|
125
126
|
read as a bar plot nests subject bars inside session ticks inside Intervention
|
|
126
127
|
brackets. Each subject keeps one small deterministic offset at every x
|
|
127
128
|
position (never a random jitter — a line must end on its own markers),
|
|
128
|
-
decided once per figure by `scistackplot.spaghetti.series_offsets` and read by
|
|
129
|
+
decided once per figure by `scistackplot.reduce.spaghetti.series_offsets` and read by
|
|
129
130
|
both renderers and the generated code.
|
|
130
131
|
|
|
131
132
|
**Show sample** puts the data behind a summary on top of it. `show_sample =
|
|
@@ -178,6 +179,42 @@ change does not apply. Save data writes ISO times and names the zone in the
|
|
|
178
179
|
header, and the exported code draws the same date ticks. See
|
|
179
180
|
`docs/claude/plot-datetimes.md`.
|
|
180
181
|
|
|
182
|
+
## Text measures
|
|
183
|
+
|
|
184
|
+
A text (or True/False) column is plotted by rewriting it into numbers first
|
|
185
|
+
(`scistackplot.reduce.categorical`), and the plot type decides how:
|
|
186
|
+
|
|
187
|
+
| Plot type | What it draws | "Show sample" |
|
|
188
|
+
|---|---|---|
|
|
189
|
+
| Count bar (the default) | records per category | — (a count has no sample) |
|
|
190
|
+
| Proportion bar + error | the mean of each unit's % ± the error band | each unit's % |
|
|
191
|
+
| Count / proportion heatmap | categories × one grouping layer | — |
|
|
192
|
+
| Strip of categories | every record at its category on a category axis | — |
|
|
193
|
+
| Spaghetti of categories / of % per unit | one line per unit across x | — |
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
from scistackplot import CategoricalOptions, CategoricalStat
|
|
197
|
+
|
|
198
|
+
spec = PlotSpec(
|
|
199
|
+
measures=["Outcome"],
|
|
200
|
+
roles={"Level": Role.GROUP, "subject": Role.COLLAPSE, "trial": Role.COLLAPSE},
|
|
201
|
+
groups=["Level"], color="Level", # one bar per category
|
|
202
|
+
kind=PlotKind.BAR,
|
|
203
|
+
categorical=CategoricalOptions(stat=CategoricalStat.PROPORTION),
|
|
204
|
+
)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Collapse means pool** for a text measure: a collapsed key's records merge
|
|
208
|
+
into one bucket, never an average of averages. A count sums every collapsed
|
|
209
|
+
key; a proportion pools everything beneath the sample key (the last
|
|
210
|
+
collapsed one) into one % per unit, then draws the mean of the units.
|
|
211
|
+
`Level` is the synthetic factor naming the categories; `CategoricalOptions.level`
|
|
212
|
+
draws one category only. A filter on the measure keeps records by category;
|
|
213
|
+
a range filter on it is refused. More than 50 distinct values is free text,
|
|
214
|
+
refused with that reason. `BarOptions(stack=True)` stacks the coloured layer
|
|
215
|
+
(any measure) — with a % per category on colour, the 100% stacked bar. See
|
|
216
|
+
`docs/claude/categorical-measures.md`.
|
|
217
|
+
|
|
181
218
|
## Histograms and regressions
|
|
182
219
|
|
|
183
220
|
Two kinds put a number line on x. A **histogram** bins the measure itself:
|
|
@@ -393,7 +430,7 @@ columns as fit. `PlotSpec.sample_in_legend=False` (the Show sample pane's
|
|
|
393
430
|
|
|
394
431
|
`StyleOptions.width` / `height` are inches and size the **saved** figure and
|
|
395
432
|
the generated code; the interactive preview fills whatever pane it is in.
|
|
396
|
-
`scistackplot.figsize` is the one vocabulary of aspect-ratio presets (`4:3`,
|
|
433
|
+
`scistackplot.text.figsize` is the one vocabulary of aspect-ratio presets (`4:3`,
|
|
397
434
|
`16:9`, `3:2`, golden, `2:1`, `1:1`, two portrait ratios, `custom`): pick a
|
|
398
435
|
ratio, name a width — a journal column is 3.5 in, a double column 7.2 in — and
|
|
399
436
|
`height_for` gives the height. `aspect_name` runs the other way, so a reopened
|
|
@@ -419,7 +456,7 @@ size (drawn at Width x Height, 1 pt = 1 px) or at the pane's size ("Fit pane").
|
|
|
419
456
|
`legend` and `legend_title` are each either fixed or `None`, which derives
|
|
420
457
|
them from `base` with matplotlib's own ratios. Only `base` set draws exactly
|
|
421
458
|
what one font knob would. A fixed size is never shrunk by the label or legend
|
|
422
|
-
fit, which may still rotate, wrap or move it. `scistackplot.textsize` is the
|
|
459
|
+
fit, which may still rotate, wrap or move it. `scistackplot.text.textsize` is the
|
|
423
460
|
one owner (`resolve_sizes`, `rc_params`). The export, the generated code and
|
|
424
461
|
the plotly preview (as px) all read it, under `rc_context` so nothing leaks
|
|
425
462
|
into the next figure. See `docs/claude/plot-text-and-labels.md`.
|
|
@@ -430,7 +467,7 @@ axis and legend titles 1.2, the rest 1.0, overridable per element in
|
|
|
430
467
|
`TextSizes.ratios`), clamped into that element's floor/ceiling (the band of
|
|
431
468
|
`TextSizes.target` × the ratio — `"print"` 8–12 pt, `"slide"` 14–28 pt — or
|
|
432
469
|
`TextSizes.floors` / `ceilings` in pt). With `base` unset (`None`),
|
|
433
|
-
`scistackplot.autosize` searches the largest reference whose real matplotlib
|
|
470
|
+
`scistackplot.text.autosize` searches the largest reference whose real matplotlib
|
|
434
471
|
layout breaks no rule: no text into text (tick fit, numeric tick collisions,
|
|
435
472
|
neighbouring panels, brackets, legend), nothing off the canvas, at least 3
|
|
436
473
|
tick labels per numeric axis, no y title taller than its panel. One failing
|
|
@@ -441,7 +478,7 @@ number in `base` fixes the reference (unclamped).
|
|
|
441
478
|
|
|
442
479
|
The figure's **paper** (white background, black text, a black frame round every
|
|
443
480
|
panel, outward ticks, no grid, and the error-bar ink) has one owner,
|
|
444
|
-
`scistackplot.paper.PAPER`. Its values are matplotlib's defaults, written
|
|
481
|
+
`scistackplot.text.paper.PAPER`. Its values are matplotlib's defaults, written
|
|
445
482
|
out. The export, the generated code and the plotly preview all draw it, so
|
|
446
483
|
the preview shows the saved figure's page rather than plotly's grid. A
|
|
447
484
|
personal `matplotlibrc` cannot change an export. The Plot Studio shows the
|
|
@@ -451,7 +488,7 @@ See `docs/claude/preview-paper-parity.md`.
|
|
|
451
488
|
`StyleOptions.sample_weight` and `StyleOptions.line_weight` are multipliers
|
|
452
489
|
(default 1) on the point size AND line thickness together: the first for the
|
|
453
490
|
"Show sample" overlay's points and joining lines, the second for a
|
|
454
|
-
spaghetti's own points and lines. `scistackplot.weights` is the one owner;
|
|
491
|
+
spaghetti's own points and lines. `scistackplot.reduce.weights` is the one owner;
|
|
455
492
|
matplotlib, the plotly preview and the generated code all read it.
|
|
456
493
|
|
|
457
494
|
## What the text reads as: display aliases
|
|
@@ -478,7 +515,7 @@ titles). `levels` is used wherever a value appears: ticks, brackets,
|
|
|
478
515
|
legend entries, panel titles and figure titles.
|
|
479
516
|
|
|
480
517
|
A scidb-backed table also carries the project's aliases (`[aliases]` in
|
|
481
|
-
`scistack.toml`, read live through `
|
|
518
|
+
`scistack.toml`, read live through `scifor.project.aliases`). The plot's own entries
|
|
482
519
|
override them field by field, and `""` shows the raw text again.
|
|
483
520
|
|
|
484
521
|
Only the text changes. Filters, facet layout rules, the level order and
|
|
@@ -486,7 +523,7 @@ Only the text changes. Filters, facet layout rules, the level order and
|
|
|
486
523
|
draws. The exported code writes the merged aliases in as a literal and
|
|
487
524
|
relabels what it drew. Two levels of one factor that would read the same are
|
|
488
525
|
refused (`AliasError`), because the figure could not tell them apart.
|
|
489
|
-
`scistackplot.aliases.DisplayText` (on `ResolvedPlot.text`) is the one owner
|
|
526
|
+
`scistackplot.text.aliases.DisplayText` (on `ResolvedPlot.text`) is the one owner
|
|
490
527
|
of how every level and name reads. See `docs/claude/plot-text-and-labels.md`.
|
|
491
528
|
|
|
492
529
|
## What colour a mark is: pinned colours
|
|
@@ -504,11 +541,11 @@ spec = PlotSpec(
|
|
|
504
541
|
```
|
|
505
542
|
|
|
506
543
|
Colours may be `#rrggbb`, `#rgb`, `rgb(r, g, b)` or a matplotlib colour
|
|
507
|
-
name. `scistackplot.colors.parse_color` is the one reader, and it
|
|
544
|
+
name. `scistackplot.text.colors.parse_color` is the one reader, and it
|
|
508
545
|
canonicalises every colour to `#rrggbb`.
|
|
509
546
|
|
|
510
547
|
A scidb-backed table also carries the project's `[colors]` (read live
|
|
511
|
-
through `
|
|
548
|
+
through `scifor.project.colors`). The plot's pins override them level by level.
|
|
512
549
|
|
|
513
550
|
A level you don't pin keeps its palette colour at its declared position, so
|
|
514
551
|
pinning one level never moves another's.
|
|
@@ -72,6 +72,7 @@ collapsed. That single rule produces both defaults and availability:
|
|
|
72
72
|
| scalar | scatter, or a bar with no error bar | box / violin / bar + CI |
|
|
73
73
|
| 1-D array | one line per leaf group | mean line + shaded error band |
|
|
74
74
|
| 2-D | heatmap | mean heatmap |
|
|
75
|
+
| text | count bar | proportion bar + error (see "Text measures") |
|
|
75
76
|
|
|
76
77
|
"Average over trials, then show the spread across subjects" is
|
|
77
78
|
`trial=COLLAPSE, subject=COLLAPSE`: trial averages within each subject
|
|
@@ -84,7 +85,7 @@ sessions inside their group. It needs two grouping layers, and the same list
|
|
|
84
85
|
read as a bar plot nests subject bars inside session ticks inside Intervention
|
|
85
86
|
brackets. Each subject keeps one small deterministic offset at every x
|
|
86
87
|
position (never a random jitter — a line must end on its own markers),
|
|
87
|
-
decided once per figure by `scistackplot.spaghetti.series_offsets` and read by
|
|
88
|
+
decided once per figure by `scistackplot.reduce.spaghetti.series_offsets` and read by
|
|
88
89
|
both renderers and the generated code.
|
|
89
90
|
|
|
90
91
|
**Show sample** puts the data behind a summary on top of it. `show_sample =
|
|
@@ -137,6 +138,42 @@ change does not apply. Save data writes ISO times and names the zone in the
|
|
|
137
138
|
header, and the exported code draws the same date ticks. See
|
|
138
139
|
`docs/claude/plot-datetimes.md`.
|
|
139
140
|
|
|
141
|
+
## Text measures
|
|
142
|
+
|
|
143
|
+
A text (or True/False) column is plotted by rewriting it into numbers first
|
|
144
|
+
(`scistackplot.reduce.categorical`), and the plot type decides how:
|
|
145
|
+
|
|
146
|
+
| Plot type | What it draws | "Show sample" |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| Count bar (the default) | records per category | — (a count has no sample) |
|
|
149
|
+
| Proportion bar + error | the mean of each unit's % ± the error band | each unit's % |
|
|
150
|
+
| Count / proportion heatmap | categories × one grouping layer | — |
|
|
151
|
+
| Strip of categories | every record at its category on a category axis | — |
|
|
152
|
+
| Spaghetti of categories / of % per unit | one line per unit across x | — |
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from scistackplot import CategoricalOptions, CategoricalStat
|
|
156
|
+
|
|
157
|
+
spec = PlotSpec(
|
|
158
|
+
measures=["Outcome"],
|
|
159
|
+
roles={"Level": Role.GROUP, "subject": Role.COLLAPSE, "trial": Role.COLLAPSE},
|
|
160
|
+
groups=["Level"], color="Level", # one bar per category
|
|
161
|
+
kind=PlotKind.BAR,
|
|
162
|
+
categorical=CategoricalOptions(stat=CategoricalStat.PROPORTION),
|
|
163
|
+
)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Collapse means pool** for a text measure: a collapsed key's records merge
|
|
167
|
+
into one bucket, never an average of averages. A count sums every collapsed
|
|
168
|
+
key; a proportion pools everything beneath the sample key (the last
|
|
169
|
+
collapsed one) into one % per unit, then draws the mean of the units.
|
|
170
|
+
`Level` is the synthetic factor naming the categories; `CategoricalOptions.level`
|
|
171
|
+
draws one category only. A filter on the measure keeps records by category;
|
|
172
|
+
a range filter on it is refused. More than 50 distinct values is free text,
|
|
173
|
+
refused with that reason. `BarOptions(stack=True)` stacks the coloured layer
|
|
174
|
+
(any measure) — with a % per category on colour, the 100% stacked bar. See
|
|
175
|
+
`docs/claude/categorical-measures.md`.
|
|
176
|
+
|
|
140
177
|
## Histograms and regressions
|
|
141
178
|
|
|
142
179
|
Two kinds put a number line on x. A **histogram** bins the measure itself:
|
|
@@ -352,7 +389,7 @@ columns as fit. `PlotSpec.sample_in_legend=False` (the Show sample pane's
|
|
|
352
389
|
|
|
353
390
|
`StyleOptions.width` / `height` are inches and size the **saved** figure and
|
|
354
391
|
the generated code; the interactive preview fills whatever pane it is in.
|
|
355
|
-
`scistackplot.figsize` is the one vocabulary of aspect-ratio presets (`4:3`,
|
|
392
|
+
`scistackplot.text.figsize` is the one vocabulary of aspect-ratio presets (`4:3`,
|
|
356
393
|
`16:9`, `3:2`, golden, `2:1`, `1:1`, two portrait ratios, `custom`): pick a
|
|
357
394
|
ratio, name a width — a journal column is 3.5 in, a double column 7.2 in — and
|
|
358
395
|
`height_for` gives the height. `aspect_name` runs the other way, so a reopened
|
|
@@ -378,7 +415,7 @@ size (drawn at Width x Height, 1 pt = 1 px) or at the pane's size ("Fit pane").
|
|
|
378
415
|
`legend` and `legend_title` are each either fixed or `None`, which derives
|
|
379
416
|
them from `base` with matplotlib's own ratios. Only `base` set draws exactly
|
|
380
417
|
what one font knob would. A fixed size is never shrunk by the label or legend
|
|
381
|
-
fit, which may still rotate, wrap or move it. `scistackplot.textsize` is the
|
|
418
|
+
fit, which may still rotate, wrap or move it. `scistackplot.text.textsize` is the
|
|
382
419
|
one owner (`resolve_sizes`, `rc_params`). The export, the generated code and
|
|
383
420
|
the plotly preview (as px) all read it, under `rc_context` so nothing leaks
|
|
384
421
|
into the next figure. See `docs/claude/plot-text-and-labels.md`.
|
|
@@ -389,7 +426,7 @@ axis and legend titles 1.2, the rest 1.0, overridable per element in
|
|
|
389
426
|
`TextSizes.ratios`), clamped into that element's floor/ceiling (the band of
|
|
390
427
|
`TextSizes.target` × the ratio — `"print"` 8–12 pt, `"slide"` 14–28 pt — or
|
|
391
428
|
`TextSizes.floors` / `ceilings` in pt). With `base` unset (`None`),
|
|
392
|
-
`scistackplot.autosize` searches the largest reference whose real matplotlib
|
|
429
|
+
`scistackplot.text.autosize` searches the largest reference whose real matplotlib
|
|
393
430
|
layout breaks no rule: no text into text (tick fit, numeric tick collisions,
|
|
394
431
|
neighbouring panels, brackets, legend), nothing off the canvas, at least 3
|
|
395
432
|
tick labels per numeric axis, no y title taller than its panel. One failing
|
|
@@ -400,7 +437,7 @@ number in `base` fixes the reference (unclamped).
|
|
|
400
437
|
|
|
401
438
|
The figure's **paper** (white background, black text, a black frame round every
|
|
402
439
|
panel, outward ticks, no grid, and the error-bar ink) has one owner,
|
|
403
|
-
`scistackplot.paper.PAPER`. Its values are matplotlib's defaults, written
|
|
440
|
+
`scistackplot.text.paper.PAPER`. Its values are matplotlib's defaults, written
|
|
404
441
|
out. The export, the generated code and the plotly preview all draw it, so
|
|
405
442
|
the preview shows the saved figure's page rather than plotly's grid. A
|
|
406
443
|
personal `matplotlibrc` cannot change an export. The Plot Studio shows the
|
|
@@ -410,7 +447,7 @@ See `docs/claude/preview-paper-parity.md`.
|
|
|
410
447
|
`StyleOptions.sample_weight` and `StyleOptions.line_weight` are multipliers
|
|
411
448
|
(default 1) on the point size AND line thickness together: the first for the
|
|
412
449
|
"Show sample" overlay's points and joining lines, the second for a
|
|
413
|
-
spaghetti's own points and lines. `scistackplot.weights` is the one owner;
|
|
450
|
+
spaghetti's own points and lines. `scistackplot.reduce.weights` is the one owner;
|
|
414
451
|
matplotlib, the plotly preview and the generated code all read it.
|
|
415
452
|
|
|
416
453
|
## What the text reads as: display aliases
|
|
@@ -437,7 +474,7 @@ titles). `levels` is used wherever a value appears: ticks, brackets,
|
|
|
437
474
|
legend entries, panel titles and figure titles.
|
|
438
475
|
|
|
439
476
|
A scidb-backed table also carries the project's aliases (`[aliases]` in
|
|
440
|
-
`scistack.toml`, read live through `
|
|
477
|
+
`scistack.toml`, read live through `scifor.project.aliases`). The plot's own entries
|
|
441
478
|
override them field by field, and `""` shows the raw text again.
|
|
442
479
|
|
|
443
480
|
Only the text changes. Filters, facet layout rules, the level order and
|
|
@@ -445,7 +482,7 @@ Only the text changes. Filters, facet layout rules, the level order and
|
|
|
445
482
|
draws. The exported code writes the merged aliases in as a literal and
|
|
446
483
|
relabels what it drew. Two levels of one factor that would read the same are
|
|
447
484
|
refused (`AliasError`), because the figure could not tell them apart.
|
|
448
|
-
`scistackplot.aliases.DisplayText` (on `ResolvedPlot.text`) is the one owner
|
|
485
|
+
`scistackplot.text.aliases.DisplayText` (on `ResolvedPlot.text`) is the one owner
|
|
449
486
|
of how every level and name reads. See `docs/claude/plot-text-and-labels.md`.
|
|
450
487
|
|
|
451
488
|
## What colour a mark is: pinned colours
|
|
@@ -463,11 +500,11 @@ spec = PlotSpec(
|
|
|
463
500
|
```
|
|
464
501
|
|
|
465
502
|
Colours may be `#rrggbb`, `#rgb`, `rgb(r, g, b)` or a matplotlib colour
|
|
466
|
-
name. `scistackplot.colors.parse_color` is the one reader, and it
|
|
503
|
+
name. `scistackplot.text.colors.parse_color` is the one reader, and it
|
|
467
504
|
canonicalises every colour to `#rrggbb`.
|
|
468
505
|
|
|
469
506
|
A scidb-backed table also carries the project's `[colors]` (read live
|
|
470
|
-
through `
|
|
507
|
+
through `scifor.project.colors`). The plot's pins override them level by level.
|
|
471
508
|
|
|
472
509
|
A level you don't pin keeps its palette colour at its declared position, so
|
|
473
510
|
pinning one level never moves another's.
|
|
@@ -33,7 +33,7 @@ from __future__ import annotations
|
|
|
33
33
|
|
|
34
34
|
from typing import Any
|
|
35
35
|
|
|
36
|
-
from .capability import (
|
|
36
|
+
from .model.capability import (
|
|
37
37
|
available_plots,
|
|
38
38
|
capabilities,
|
|
39
39
|
default_plot,
|
|
@@ -47,25 +47,33 @@ from .capability import (
|
|
|
47
47
|
variant_summary,
|
|
48
48
|
why_unavailable,
|
|
49
49
|
)
|
|
50
|
-
from .
|
|
51
|
-
|
|
50
|
+
from .reduce.categorical import (
|
|
51
|
+
LEVEL_FACTOR,
|
|
52
|
+
MAX_CATEGORY_LEVELS,
|
|
53
|
+
apply_categorical,
|
|
54
|
+
categorical_mode,
|
|
55
|
+
mode_for_kind,
|
|
56
|
+
)
|
|
57
|
+
from .reduce.stacking import stack_bases, stacks
|
|
58
|
+
from .reduce.cell import apply_cell_collapse, cell_collapse_note, cell_collapses, effective_shape
|
|
59
|
+
from .export.codegen import (
|
|
52
60
|
default_function_name,
|
|
53
61
|
extract_spec,
|
|
54
62
|
generate_plot_function,
|
|
55
63
|
generate_script,
|
|
56
64
|
)
|
|
57
|
-
from .export import (
|
|
65
|
+
from .export.plot_data import (
|
|
58
66
|
DataDepth,
|
|
59
67
|
DataExportOptions,
|
|
60
68
|
data_export_options,
|
|
61
69
|
data_unavailable,
|
|
62
70
|
plot_data,
|
|
63
71
|
)
|
|
64
|
-
from .reduce import MAX_TRANSPORT_POINTS, resolve, resolve_one
|
|
65
|
-
from .figure_file import WrittenFigure, canvas_overflow, write_figure
|
|
72
|
+
from .reduce.resolve import MAX_TRANSPORT_POINTS, resolve, resolve_one
|
|
73
|
+
from .export.figure_file import WrittenFigure, canvas_overflow, write_figure
|
|
66
74
|
from .render import layout_decisions, render_matplotlib, render_plotly
|
|
67
|
-
from .resolved import Encoding, Labels, Panel, ResolvedPlot
|
|
68
|
-
from .roles import (
|
|
75
|
+
from .reduce.resolved import Encoding, Labels, Panel, ResolvedPlot
|
|
76
|
+
from .model.roles import (
|
|
69
77
|
Assignment,
|
|
70
78
|
GroupingLayers,
|
|
71
79
|
OverlayJoin,
|
|
@@ -86,6 +94,7 @@ from .roles import (
|
|
|
86
94
|
overlay_join,
|
|
87
95
|
overlay_steps,
|
|
88
96
|
overlay_unavailable,
|
|
97
|
+
overlay_is_rug,
|
|
89
98
|
role_for_new_grouping,
|
|
90
99
|
roles_for_kind,
|
|
91
100
|
sample_key,
|
|
@@ -94,10 +103,10 @@ from .roles import (
|
|
|
94
103
|
validate,
|
|
95
104
|
with_requirements_for,
|
|
96
105
|
)
|
|
97
|
-
from .restore import NoteKind, RestoreError, RestoreNote, Restored, reconcile, restore_spec
|
|
98
|
-
from .presets import FieldClass, apply_preset, make_template, shape_warning
|
|
99
|
-
from .compare import CompareMode, Comparison
|
|
100
|
-
from .custom import (
|
|
106
|
+
from .model.restore import NoteKind, RestoreError, RestoreNote, Restored, reconcile, restore_spec
|
|
107
|
+
from .model.presets import FieldClass, apply_preset, make_template, shape_warning
|
|
108
|
+
from .reduce.compare import CompareMode, Comparison
|
|
109
|
+
from .export.custom import (
|
|
101
110
|
CustomCall,
|
|
102
111
|
CustomFunctionError,
|
|
103
112
|
CustomSignature,
|
|
@@ -109,11 +118,15 @@ from .custom import (
|
|
|
109
118
|
resolve_custom,
|
|
110
119
|
resolve_custom_one,
|
|
111
120
|
)
|
|
112
|
-
from .diffbars import DifferenceBar, bars_for_panel, slot_endpoints
|
|
113
|
-
from .panels import PanelOverride, override_for
|
|
114
|
-
from .
|
|
121
|
+
from .reduce.diffbars import DifferenceBar, bars_for_panel, slot_endpoints
|
|
122
|
+
from .reduce.panels import PanelOverride, override_for
|
|
123
|
+
from .reduce.rows import ROW_FACTOR, element_values, explode_row_lists, row_factor, row_origin
|
|
124
|
+
from .model.shape import Shape, classify_column, classify_value, is_plottable
|
|
115
125
|
from .sources import BaseSource, CsvSource, DataFrameSource, DataSource, UnknownMeasureError
|
|
116
|
-
from .spec import (
|
|
126
|
+
from .model.spec import (
|
|
127
|
+
BarOptions,
|
|
128
|
+
CategoricalOptions,
|
|
129
|
+
CategoricalStat,
|
|
117
130
|
Aggregation,
|
|
118
131
|
BinMode,
|
|
119
132
|
CONTINUOUS_X_KINDS,
|
|
@@ -121,6 +134,8 @@ from .spec import (
|
|
|
121
134
|
HistMultiple,
|
|
122
135
|
HistStat,
|
|
123
136
|
HistogramOptions,
|
|
137
|
+
KdeOptions,
|
|
138
|
+
UNIVARIATE_KINDS,
|
|
124
139
|
RegressionOptions,
|
|
125
140
|
StatsCorner,
|
|
126
141
|
LegacySpecError,
|
|
@@ -152,9 +167,9 @@ from .spec import (
|
|
|
152
167
|
grid_shape_for,
|
|
153
168
|
is_horizontal,
|
|
154
169
|
)
|
|
155
|
-
from .bins import BinEdges, BinError, bin_edges
|
|
156
|
-
from .fits import PanelFit, annotation_text
|
|
157
|
-
from .textsize import (
|
|
170
|
+
from .reduce.bins import BinEdges, BinError, bin_edges
|
|
171
|
+
from .reduce.fits import PanelFit, annotation_text
|
|
172
|
+
from .text.textsize import (
|
|
158
173
|
BANDS,
|
|
159
174
|
DEFAULT_TEXT_RATIOS,
|
|
160
175
|
ResolvedSizes,
|
|
@@ -163,10 +178,10 @@ from .textsize import (
|
|
|
163
178
|
resolve_sizes,
|
|
164
179
|
sizes_for,
|
|
165
180
|
)
|
|
166
|
-
from .autosize import AutoTextSize, settle as settle_text_size
|
|
167
|
-
from .aliases import AliasError, DisplayText, display_text
|
|
168
|
-
from .colors import ColorError, MarkColors, mark_colors, parse_color
|
|
169
|
-
from .figsize import (
|
|
181
|
+
from .text.autosize import AutoTextSize, settle as settle_text_size
|
|
182
|
+
from .text.aliases import AliasError, DisplayText, display_text
|
|
183
|
+
from .text.colors import ColorError, MarkColors, mark_colors, parse_color
|
|
184
|
+
from .text.figsize import (
|
|
170
185
|
ASPECT_PRESETS,
|
|
171
186
|
CUSTOM as CUSTOM_ASPECT,
|
|
172
187
|
AspectPreset,
|
|
@@ -175,7 +190,7 @@ from .figsize import (
|
|
|
175
190
|
height_for,
|
|
176
191
|
presets_payload,
|
|
177
192
|
)
|
|
178
|
-
from .ticklabels import (
|
|
193
|
+
from .text.ticklabels import (
|
|
179
194
|
BRACKET_POLICY,
|
|
180
195
|
TICK_POLICY,
|
|
181
196
|
LabelFit,
|
|
@@ -184,10 +199,10 @@ from .ticklabels import (
|
|
|
184
199
|
fit_labels,
|
|
185
200
|
slot_row,
|
|
186
201
|
)
|
|
187
|
-
from .xaxis import XGroup, XPlan, leaf_key, plan_x_axis
|
|
188
|
-
from .ylimits import describe as describe_y_limits
|
|
189
|
-
from .ylimits import eligible_scope, limits_by_scope
|
|
190
|
-
from .table import (
|
|
202
|
+
from .text.xaxis import XGroup, XPlan, leaf_key, plan_x_axis
|
|
203
|
+
from .reduce.ylimits import describe as describe_y_limits
|
|
204
|
+
from .reduce.ylimits import eligible_scope, limits_by_scope
|
|
205
|
+
from .model.table import (
|
|
191
206
|
CODE_FACTOR_PREFIX,
|
|
192
207
|
MISSING_LEVEL,
|
|
193
208
|
RUN_FACTOR_PREFIX,
|
|
@@ -196,7 +211,7 @@ from .table import (
|
|
|
196
211
|
MeasureInfo,
|
|
197
212
|
natural_sort_key,
|
|
198
213
|
)
|
|
199
|
-
from .variants import (
|
|
214
|
+
from .reduce.variants import (
|
|
200
215
|
LATEST,
|
|
201
216
|
VARIANT_FACTOR,
|
|
202
217
|
apply_variant_sets,
|
|
@@ -245,8 +260,20 @@ __all__ = [
|
|
|
245
260
|
"CONTINUOUS_X_KINDS",
|
|
246
261
|
"FitBy",
|
|
247
262
|
"HistMultiple",
|
|
263
|
+
"BarOptions",
|
|
264
|
+
"CategoricalOptions",
|
|
265
|
+
"CategoricalStat",
|
|
266
|
+
"LEVEL_FACTOR",
|
|
267
|
+
"MAX_CATEGORY_LEVELS",
|
|
268
|
+
"apply_categorical",
|
|
269
|
+
"categorical_mode",
|
|
270
|
+
"mode_for_kind",
|
|
271
|
+
"stack_bases",
|
|
272
|
+
"stacks",
|
|
248
273
|
"HistStat",
|
|
249
274
|
"HistogramOptions",
|
|
275
|
+
"KdeOptions",
|
|
276
|
+
"UNIVARIATE_KINDS",
|
|
250
277
|
"RegressionOptions",
|
|
251
278
|
"StatsCorner",
|
|
252
279
|
"BinEdges",
|
|
@@ -331,6 +358,11 @@ __all__ = [
|
|
|
331
358
|
"FactorInfo",
|
|
332
359
|
"MISSING_LEVEL",
|
|
333
360
|
"MeasureInfo",
|
|
361
|
+
"ROW_FACTOR",
|
|
362
|
+
"element_values",
|
|
363
|
+
"explode_row_lists",
|
|
364
|
+
"row_factor",
|
|
365
|
+
"row_origin",
|
|
334
366
|
"Shape",
|
|
335
367
|
"classify_value",
|
|
336
368
|
"classify_column",
|
|
@@ -382,6 +414,7 @@ __all__ = [
|
|
|
382
414
|
"OverlaySteps",
|
|
383
415
|
"OverlayJoin",
|
|
384
416
|
"overlay_unavailable",
|
|
417
|
+
"overlay_is_rug",
|
|
385
418
|
"overlay_steps",
|
|
386
419
|
"overlay_join",
|
|
387
420
|
"overlay_color",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Outputs other than the two renderers: generated plot code, plot data, custom plot functions, figure files."""
|