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

Skip to content

BUG: Fix performance regression when plotting values from Numpy array sub-classes #14289

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
May 21, 2019

Conversation

astrofrog
Copy link
Contributor

@astrofrog astrofrog commented May 21, 2019

PR Summary

This fixes the issue described in #14274 that plotting with Astropy Quantities is now very slow in Matplotlib 3.1.0.

Note that given the existing test, the code could have even been written as:

    if len(X) == 0:
        return [[]]
    elif X.ndim == 1:
        # 1D array of scalars: directly return it.
        return [X]

so I've also added a more involved test to make sure that what #11921 was trying to fix still works, as well as a regression test for #14274

cc @anntzer and @jklymak

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 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

@astrofrog astrofrog force-pushed the fix-reshape-2d-subclass branch from c1eb2b4 to 7d26ea3 Compare May 21, 2019 08:00
…classes that needed to be internally reshaped to lists of 1D arrays.
@astrofrog astrofrog force-pushed the fix-reshape-2d-subclass branch from 7d26ea3 to 5fc168d Compare May 21, 2019 08:04
@dstansby dstansby added this to the v3.1.1 milestone May 21, 2019
@dstansby dstansby added topic: units and array ducktypes Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labels May 21, 2019
Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, thanks for the fix

@tacaswell tacaswell merged commit 4edadf9 into matplotlib:master May 21, 2019
@tacaswell
Copy link
Member

Thanks @astrofrog !

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 21, 2019
…otting values from Numpy array sub-classes
dstansby added a commit that referenced this pull request May 21, 2019
…289-on-v3.1.x

Backport PR #14289 on branch v3.1.x (BUG: Fix performance regression when plotting values from Numpy array sub-classes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: units and array ducktypes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants