Skip to content

Multiplotting overhaul#49

Merged
JamesMcClung merged 142 commits into
mainfrom
split-vars
Jul 22, 2026
Merged

Multiplotting overhaul#49
JamesMcClung merged 142 commits into
mainfrom
split-vars

Conversation

@JamesMcClung

@JamesMcClung JamesMcClung commented Jul 22, 2026

Copy link
Copy Markdown
Owner

This is a major change, and likely introduces some regressions.

Features

Overplotting

This is the motivating feature. Psc-plot can now plot multiple datasets at once, either in separate axes or overplotted. To do so, use --with and multiple --versus. For example, the following plots both $B_x(y)$ and $B_z(y)$ on the same axis:

psc-plot pfd hx_fc -v y --with hz_fc -v y

Overplotting with more than 2 images or any number of scatterplots and/or polar meshes is not yet supported.

Multiple Axes

A plot can be positioned within a figure by passing loc=i,j to --versus. Per matplotlib custom, i and j are 1-indexed. The default is 1,1. For example, to stack two images vertically:

psc-plot pfd hx_fc -v y z --with hz_fc -v y z loc=1,2

The layout is still work-in-progress. Eventually, axes and labels will be shared when possible.

Multiple Loaders

It is possible to switch between prefixes using --with. For example:

psc-plot prt.i --bin y uy=100 -v y uy --nan0 --scale log --with pfd::ey_ec -v y

Note that --scale above applies to the particle color scale, but not the $E_y$ vertical scale.

Constrained Layout

Figures use a "constrained" layout instead of a "tight" layout now, resulting in less whitespace padding.

Help Doesn't Require Data

psc-plot -h no longer complains about missing data dir if none is set.

Internal Changes

Decoupled Field Data

This is actually an observable change. Field data is no longer stored as an xr.Dataset. It's now a dict of keys to xr.DataArrays, which is basically what a Dataset is, but without any coupling of coordinates between the DataArrays.

Data World

Adaptors now transform "data worlds", which is basically a dict of prefixes to data-metadata structs. (Before, they just transformed individual structs.) Loaders are thus technically adaptors now.

Plot Targets

A data world also has a list of "plot targets". These are set by --versus and replaces some old metadata.

Plot Infos

Renderers now transform plot targets and their associated data into "plot infos". Each plot info is hooked up to an actual matplotlib object via callbacks. Renderers simply update the plot infos at each frame; the callbacks handle updating the figure.

JamesMcClung and others added 25 commits July 21, 2026 12:36
this does break derived field variables somewhat, which no longer have
a way to signal new dimensions
The node-graph / DataWorld / WorldAdaptor / PlotInfo refactor on this
branch diverged from the documented (main) design. Rewrites the data
flow, adaptor hierarchy, and data-wrapper sections and adds PlotTarget,
PlotInfo/AxesManager, and Hook sections to match.

Co-Authored-By: Claude <noreply@anthropic.com>
Dead code: isinstance2 was never imported anywhere.

Co-Authored-By: Claude <noreply@anthropic.com>
Fix misspelling; callers updated to keep imports resolving.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
It's a list forwarded to Plot(renderers: list[...]); singular name was misleading.

Co-Authored-By: Claude <noreply@anthropic.com>
save_dpi is Optional (compile passes args.save_dpi, default None).

Co-Authored-By: Claude <noreply@anthropic.com>
because setting x_data or y_data separately was invalid when lengths differed between frames
@JamesMcClung JamesMcClung added enhancement New feature or request refactor Internal simplifications or generalizations labels Jul 22, 2026
@JamesMcClung
JamesMcClung merged commit fe5cc54 into main Jul 22, 2026
2 checks passed
@JamesMcClung
JamesMcClung deleted the split-vars branch July 22, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactor Internal simplifications or generalizations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant