Skip to content

feat(plot): adopt cleopatra 0.29 and expose ColorBar on the mesh/UGRID plot path #933

Description

@MAfarrag

Context

cleopatra 0.29 (serapeum-org/cleopatra#244, closing #239) lifted the typed ColorBar spec to the shared
Glyph base, so MeshGlyph.plot / .animate (and FlowGlyph / KDEGlyph / ScatterGlyph / PolygonGlyph /
VectorGlyph) now accept colorbar=bool | ColorBar | None and emit the loose-cbar_* DeprecationWarning
uniformly. pyramids pins the [viz] floor at cleopatra >= 0.28, where MeshGlyph.plot's colorbar is still a
plain bool with no ColorBar support.

This is the mesh half of the typed plot-spec migration. The raster half is done — #926 (adopt 0.28 + the
typed specs) and the refactor/plot-deprecate-loose-cbar-kwargs branch (surface the cbar_* deprecation on
every raster plot path). The UGRID example notebooks are the only remaining first-class cbar_label users
because the mesh backend could not take a ColorBar — which cleopatra 0.29 now fixes.

Related: #926, and cleopatra #239 / #244.

Problem / Current Behaviour

  • UgridDataset.plot / mesh_render cannot forward colorbar=ColorBar(...) — on the 0.28 floor MeshGlyph.plot
    has colorbar: bool, so the typed spec would be rejected.
  • The UGRID example notebooks (docs/examples/netcdf/ugrid/*.ipynb) still configure the colour bar with the
    loose cbar_label because there was no typed alternative on the mesh path.
  • Loose cbar_* on the mesh path never warned (cleopatra 0.28 added the deprecation only to ArrayGlyph); 0.29
    adds it to MeshGlyph, so once adopted the mesh path warns like the raster path.

Affected locations

File Symbol Notes
pyproject.toml [project.optional-dependencies] viz bump floor to cleopatra[tiles]>=0.29.0
src/pyramids/dataset/_plot_helpers.py mesh_render forward colorbar= (bool | ColorBar) to MeshGlyph.plot
src/pyramids/netcdf/ugrid/plot.py plot_mesh_data accept + pass colorbar=
src/pyramids/netcdf/ugrid/dataset.py UgridDataset.plot expose/document colorbar=
docs/examples/netcdf/ugrid/*.ipynb migrate cbar_labelcolorbar=ColorBar(label=...)

Proposed Solution

  • Bump the viz extra to cleopatra[tiles]>=0.29.0 (regenerate pixi.lock).
  • Forward colorbar= (bool | ColorBar) through mesh_renderplot_mesh_dataMeshGlyph.plot, mirroring
    the raster facade, and document it on UgridDataset.plot (re-using pyramids.plot.ColorBar).
  • Migrate the UGRID example notebooks from cbar_label onto colorbar=ColorBar(label=...).

Out of Scope

The raster cbar_* deprecation surfacing (done on refactor/plot-deprecate-loose-cbar-kwargs).

Effort Estimate

Size: MRationale: a dep bump + mesh-facade forwarding + notebook migration; no new algorithm.

Definition of Done

  • viz floor is cleopatra[tiles]>=0.29.0; pixi.lock regenerated
  • UgridDataset.plot(colorbar=ColorBar(...)) renders on the mesh path
  • the UGRID example notebooks use colorbar=ColorBar(...) (no loose cbar_label)
  • tests cover the mesh colorbar= forwarding; existing tests pass

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions