Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

imshow with LogNorm crashes with certain inputs #18415

Closed
Assignees
tacaswell
Milestone
@LevN0

Description

@LevN0

Bug report

Bug summary

Due to changes introduced in3dea5c7, trying to display some images with LogNorm will crash because vmin gets auto-adjusted to 0 (which is invalid for LogNorm).

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltfrommatplotlib.colorsimportLogNormdata=np.full((500,500),-1,dtype=np.float64)data[0:250, :]=1E20fig,ax=plt.subplots()im=ax.imshow(data,norm=LogNorm(vmin=100,vmax=data.max()))plt.show()

Actual outcome

  File "C:\Python38\lib\site-packages\matplotlib\image.py", line 922, in make_image    return self._make_image(self._A, bbox, transformed_bbox, clip,  File "C:\Python38\lib\site-packages\matplotlib\image.py", line 541, in _make_image    output = self.norm(resampled_masked)  File "C:\Python38\lib\site-packages\matplotlib\colors.py", line 1193, in __call__    self._check_vmin_vmax()  File "C:\Python38\lib\site-packages\matplotlib\colors.py", line 1182, in _check_vmin_vmax    raise ValueError("minvalue must be positive")ValueError: minvalue must be positive

Expected outcome

Showed a plot in MPL 3.1 (and I believe every version until 3.3). The crash is coming from _make_image transforming vmin to be zero per changes added in3dea5c7. I guess perhaps the solution is "then don't try to plot that, use a vmin closer to your vmax" but kind of inconvenient for code that previously worked fine.

Matplotlib version: 3.3.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp