FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

FIX: image respect norm limits w/ None by jklymak · Pull Request #11047 · matplotlib/matplotlib · GitHub

Repository navigation

FIX: image respect norm limits w/ None - #11047

Merged
tacaswell merged 3 commits into
matplotlib:masterfrom
jklymak:fix-image-respect-norm-limits
May 14, 2018
Merged

tacaswell merged 3 commits into
matplotlib:masterfrom
jklymak:fix-image-respect-norm-limits

Conversation

jklymak commented Apr 13, 2018 •
edited
Loading

Copy link
Copy Markdown
Member

PR Summary

Re-closes #10072

We are slowly suqishing the "big number" bugs in imshow.

This one was caused by only specifying vmax but not vmin. Algorithm is the same as before, but if vmin is None, then we scale by a_min.

import matplotlib.pyplot as plt
import numpy as np

x=np.random.random([3,3])
x[1,1]=1.e80
plt.imshow(x,vmax=2)

plt.show()

Before

After

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

jklymak added this to the v2.2.3 milestone Apr 13, 2018
jklymak requested a review from tacaswell April 13, 2018 16:50
Comment thread lib/matplotlib/image.py Outdated
a_max = np.float64(newmax)
if newmax is not None or newmin is not None:
A_scaled = np.clip(A_scaled, newmin, newmax)
vmin = self.norm.vmin if self.norm.vmin is not None else a_min

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I would do if self.norm.vmin is None or self.norm.vmax is None: self.norm.autoscale_None(A)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sure - its OK to modify the norm here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

don't even need the if-statement in that case.

jklymak added the API: consistency Consistency of the matplotlib API, including naming, behavior, defaults, … label Apr 13, 2018
jklymak force-pushed the fix-image-respect-norm-limits branch from 9d17f6f to 023ddb8 Compare April 13, 2018 19:53

jklymak commented Apr 18, 2018

Copy link
Copy Markdown
Member Author

Ping @tacaswell

timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please squash before merging.

jklymak force-pushed the fix-image-respect-norm-limits branch from 023ddb8 to 918c8a5 Compare May 6, 2018 15:28

jklymak commented May 6, 2018

Copy link
Copy Markdown
Member Author

squashed and rebased....

jklymak closed this May 6, 2018
jklymak reopened this May 6, 2018
jklymak requested a review from tacaswell May 7, 2018 21:45
jklymak force-pushed the fix-image-respect-norm-limits branch from 918c8a5 to 8d53a8a Compare May 9, 2018 20:32
tacaswell merged commit 59e550b into matplotlib:master May 14, 2018

lumberbot-app Bot commented May 14, 2018

Copy link
Copy Markdown

There seem to be a conflict, please backport manually

Copy link
Copy Markdown
Member

Does this want a backport to 2.2.x?

tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Aug 4, 2018
…rm-limits

FIX: image respect norm limits w/ None
Conflicts:
	lib/matplotlib/image.py
          - keep changes backported from master.  Looks like conflict
            was due to some white-space clean up done on master.

Copy link
Copy Markdown
Member

backported to v2.2.x as faf9684

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API: consistency Consistency of the matplotlib API, including naming, behavior, defaults, …

Projects

None yet

Development

Successfully merging this pull request may close these issues.

imshow doesn't properly display some images

4 participants


Back | FazBrowse Home | New Git URL