Skip to content

Documents · Verb reference

plot

Plot a cube using the CubePlot grammar and keep the cube flowing.

Callable type: Grammar verb / pipe stage · Browse: Visualization

Usage

from cubedynamics import verbs as v
v.plot(da=None, *, title=None, cmap='viridis', size_px=None, thin_time_factor=4, time_dim=None, clim=None, camera=None, axis_rig=True, fig_id=None, fig_title=None, fig_text=None)

Arguments

Argument Meaning Default
da Input cube with dims (time, y, x). If None, a verb is returned. None
title Override the viewer title. Defaults to time × y × x cube. None
cmap Colormap used for the fill scale. 'viridis'
size_px Pixel size for each facet tile. If omitted, the viewer uses responsive sizing. None
thin_time_factor Decimation factor for time frames to keep the viewer responsive. 4
time_dim Name of the temporal dimension. Inferred when not provided. None
clim Color limits for the continuous scale. None
camera Plotly-style camera configuration used to set the initial cube view. When omitted, a front-right, zoomed-out default is applied. None
axis_rig See implementation docstring below; no parameter-specific description supplied. True
fig_id Caption metadata used by the viewer export helpers. None
fig_title Caption metadata used by the viewer export helpers. None
fig_text Caption metadata used by the viewer export helpers. None

Accepts

Side-effect verb (cube → cube, produces output). When called with da it immediately builds a :class:~cubedynamics.plotting.cube_plot.CubePlot and returns it while leaving the cube unchanged. When called without da it returns a pipe-ready :class:~cubedynamics.piping.Verb so you can write pipe(cube) | v.plot(...).

Returns

CubePlot or Verb Viewer ready for notebook display, or a pipe-ready verb when da is omitted.

Order / grammar behavior

Side-effect verb (cube → cube, produces output). When called with da it immediately builds a :class:~cubedynamics.plotting.cube_plot.CubePlot and returns it while leaving the cube unchanged. When called without da it returns a pipe-ready :class:~cubedynamics.piping.Verb so you can write pipe(cube) | v.plot(...).

Minimal example

Run from the repository root after python -m pip install -e '.[vignettes]'. Uses the checked observational PRISM fixture; no network is required.

from pathlib import Path
import xarray as xr
import matplotlib.pyplot as plt
from cubedynamics import pipe, verbs as v

# Frozen, reviewed PRISM observations; run from the repository root.
path = Path("tests/fixtures/real_data/prism_boulder_january_2024.nc")
with xr.open_dataset(path, engine="scipy") as observed:
    cube = observed["tmax"].load()
assert cube.attrs["units"] == "degC"

result = pipe(cube) | v.plot(title="Observed PRISM temperature")
# In Jupyter, display the pipe to interact with its attached HTML viewer.
from IPython.display import display
display(result)

Works with

Side-effect verb (cube → cube, produces output). When called with da it immediately builds a :class:~cubedynamics.plotting.cube_plot.CubePlot and returns it while leaving the cube unchanged. When called without da it returns a pipe-ready :class:~cubedynamics.piping.Verb so you can write pipe(cube) | v.plot(...).

See also

Implementation notes

The viewer preserves dask-backed arrays and only samples minimal data for thumbnails, keeping streaming behavior intact. If a vase is attached in da.attrs['vase'] a thin outline overlay is attempted. The original cube is returned unchanged so pipe chains continue.

Implementation source. Signatures and descriptions on this page are generated from this checkout, not hand-maintained copies.