Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Don't fail on empty autoscale_None. #9195

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 1 commit into from
Sep 18, 2017

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 17, 2017

Closes #9194.

We reuse the same strategy as in the default Normalize.autoscale_None.

First convert the input to an array because that's what np.size and
np.ma.min/max do anyways, so it's more efficient to do it just once.

PR Summary

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

@dstansby
Copy link
Member

Might be a good idea to add ax.imshow([[]], norm=LogNorm()) as a test too?

We reuse the same strategy as in the default Normalize.autoscale_None.

First convert the input to an array because that's what np.size and
np.ma.min/max do anyways, so it's more efficient to do it just once.
@anntzer
Copy link
Contributor Author

anntzer commented Sep 17, 2017

done

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Sep 17, 2017
@dstansby dstansby merged commit f945eca into matplotlib:master Sep 18, 2017
@CJ-Wright
Copy link

Thank you!

@anntzer anntzer deleted the empty-lognorm branch September 18, 2017 15:06
dstansby added a commit that referenced this pull request Sep 19, 2017
Don't fail on empty autoscale_None.
@dstansby
Copy link
Member

Backported to 2.1.x via. b4788ba

colors.LogNorm,
lambda: colors.SymLogNorm(1),
lambda: colors.PowerNorm(1)])
@pytest.mark.filterwarnings("ignore:Attempting to set identical left==right")
Copy link
Member

Choose a reason for hiding this comment

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

For future reference, this was added in pytest 3.2 and our docs only say we require 3.0, so it probably shouldn't be relied upon.

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

Successfully merging this pull request may close these issues.

LogNorm on empty image fails
5 participants