Skip to content
Open
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` raising `AttributeError` on NumPy 2 when `out_range` is a pair, by replacing the removed `np.float_` with `np.float64` [[#5893](https://github.com/plotly/plotly.py/issues/5893)]
- 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
5 changes: 5 additions & 0 deletions tests/test_optional/test_px/test_imshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ def test_imshow_source_dtype_zmax(dtype, contrast_rescaling):
< 1
)

def test_rescale_intensity_out_range_pair():
# Regression test for #5893: np.float_ was removed in NumPy 2.0
out = rescale_intensity(np.arange(4, dtype=np.uint8), out_range=(0, 1))
assert out.dtype == np.float64
np.testing.assert_allclose(out, [0.0, 1 / 3, 2 / 3, 1.0])

@pytest.mark.parametrize("backend", ["auto", "pypng", "pil"])
def test_imshow_backend(backend):
Expand Down