Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions xarray_plotly/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ def imshow(

Slot order: y (rows) -> x (columns) -> facet_col -> animation_frame

Note:
**Difference from px.imshow**: Color bounds are computed from the
entire dataset by default, ensuring consistent coloring across
animation frames. Use `zmin`/`zmax` to override.

Args:
x: Dimension for x-axis (columns). Default: second dimension.
y: Dimension for y-axis (rows). Default: first dimension.
Expand Down
10 changes: 9 additions & 1 deletion xarray_plotly/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,14 @@ def imshow(
Both x and y are dimensions. Dimensions fill slots in order:
y (rows) -> x (columns) -> facet_col -> animation_frame

.. note::
**Difference from plotly.express.imshow**: By default, color bounds
(zmin/zmax) are computed from the **entire dataset**, ensuring
consistent coloring across animation frames and facets. In contrast,
``px.imshow`` auto-scales each frame independently, which can make
animations visually confusing. Set ``zmin`` and ``zmax`` explicitly
to override this behavior.

Parameters
----------
darray
Expand All @@ -422,7 +430,7 @@ def imshow(
Dimension for animation. Default: fourth dimension.
robust
If True, compute color bounds using 2nd and 98th percentiles
for robustness against outliers. Default: False.
for robustness against outliers. Default: False (uses min/max).
**px_kwargs
Additional arguments passed to `plotly.express.imshow()`.
Use `zmin` and `zmax` to manually set color scale bounds.
Expand Down