Skip to content

Commit 16bb706

Browse files
authored
Add missing infos to docstring (#14)
1 parent d50e2e4 commit 16bb706

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

xarray_plotly/accessor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ def imshow(
257257
258258
Slot order: y (rows) -> x (columns) -> facet_col -> animation_frame
259259
260+
Note:
261+
**Difference from px.imshow**: Color bounds are computed from the
262+
entire dataset by default, ensuring consistent coloring across
263+
animation frames. Use `zmin`/`zmax` to override.
264+
260265
Args:
261266
x: Dimension for x-axis (columns). Default: second dimension.
262267
y: Dimension for y-axis (rows). Default: first dimension.

xarray_plotly/plotting.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,14 @@ def imshow(
408408
Both x and y are dimensions. Dimensions fill slots in order:
409409
y (rows) -> x (columns) -> facet_col -> animation_frame
410410
411+
.. note::
412+
**Difference from plotly.express.imshow**: By default, color bounds
413+
(zmin/zmax) are computed from the **entire dataset**, ensuring
414+
consistent coloring across animation frames and facets. In contrast,
415+
``px.imshow`` auto-scales each frame independently, which can make
416+
animations visually confusing. Set ``zmin`` and ``zmax`` explicitly
417+
to override this behavior.
418+
411419
Parameters
412420
----------
413421
darray
@@ -422,7 +430,7 @@ def imshow(
422430
Dimension for animation. Default: fourth dimension.
423431
robust
424432
If True, compute color bounds using 2nd and 98th percentiles
425-
for robustness against outliers. Default: False.
433+
for robustness against outliers. Default: False (uses min/max).
426434
**px_kwargs
427435
Additional arguments passed to `plotly.express.imshow()`.
428436
Use `zmin` and `zmax` to manually set color scale bounds.

0 commit comments

Comments
 (0)