Skip to content
Closed
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Remove Python 3.8 and Python 3.9 support. plotly.py now requires Python 3.10 or later. [[#5883](https://github.com/plotly/plotly.py/pull/5883)]

### Fixed
- Fix `rescale_intensity` in `plotly.express.imshow_utils` raising `AttributeError` under NumPy 2 when `out_range` is a `(min, max)` pair, by replacing the removed `np.float_` alias with `np.float64` [[#5890](https://github.com/plotly/plotly.py/pull/5890)], with thanks to @youssef-elaasri for the contribution!
- Fix figures in JupyterLab not redrawing when their output is updated with `update_display_data` (for example `DisplayHandle.update`), which also kept animations in other kernels on their first frame [[#5865](https://github.com/plotly/plotly.py/pull/5865)], with thanks to @AllenDowney for the contribution!
- Fix `mpl_to_plotly` tick marker mirroring, axis positioning, and trace visibility for twinned and overlaid subplots (such as `twinx` and `twiny`) [[#5310](https://github.com/plotly/plotly.py/pull/5310)], with thanks to @robertoffmoura for the contribution!
- Fix `mpl_to_plotly` losing matplotlib axis line colors by exporting the color of each axis's displayed spine to the plotly x and y axis `linecolor` [[#5311](https://github.com/plotly/plotly.py/pull/5311)], with thanks to @robertoffmoura for the contribution!
Expand Down
2 changes: 1 addition & 1 deletion plotly/express/imshow_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _output_dtype(dtype_or_range):
"""
if type(dtype_or_range) in [list, tuple, np.ndarray]:
# pair of values: always return float.
return np.float_
return np.float64
if isinstance(dtype_or_range, type):
# already a type: return it
return dtype_or_range
Expand Down
8 changes: 8 additions & 0 deletions tests/test_optional/test_px/test_imshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,3 +553,11 @@ def test_imshow_xarray_facet_row_and_col():
annotations = [a.text for a in fig.layout.annotations]
assert any("row_dim=R1" in a for a in annotations)
assert any("col_dim=C1" in a for a in annotations)


def test_rescale_intensity_out_range_pair():
# A (min, max) out_range used np.float_, which NumPy 2 removed
img = np.arange(100, dtype=np.uint8).reshape((10, 10))
out = rescale_intensity(img, out_range=(0, 1))
assert out.dtype == np.float64
assert out.min() == 0 and out.max() == 1