8000 FIX: image respect norm limits w/ None by jklymak · Pull Request #11047 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX: image respect norm limits w/ None #11047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 14, 2018

Conversation

jklymak
Copy link
Member
@jklymak jklymak commented Apr 13, 2018

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

figure_1

After

figur

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 jklymak added this to the v2.2.3 milestone Apr 13, 2018
@jklymak jklymak requested a review from tacaswell April 13, 2018 16:50
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
Member

Choose a reason for hiding this comment

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

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure - its OK to modify the norm here?

Copy link
Member Author

Choose a reason for hiding this comment

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

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

@jklymak jklymak force-pushed the fix-image-respect-norm-limits branch from 9d17f6f to 023ddb8 Compare April 13, 2018 19:53
@jklymak
Copy link
Member Author
jklymak commented Apr 18, 2018

Ping @tacaswell

Copy link
Member
@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Please squash before merging.

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

squashed and rebased....

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

There seem to be a conflict, please backport manually

@dstansby
Copy link
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.
@tacaswell
Copy link
Member

backported to v2.2.x as faf9684

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

imshow doesn't properly display some images
4 participants
0