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

Skip to content

New style for fast plotting, updated performance docs #8957

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
Aug 25, 2017

Conversation

kbrose
Copy link
Contributor

@kbrose kbrose commented Jul 29, 2017

PR Summary

  • Add a lightweight new style that values plotting speed over pixel-perfect accuracy in plotting.
  • Update performance docs section.

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/whats_new.rst if major new feature
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer
Copy link
Contributor

anntzer commented Jul 30, 2017

I tried looking for the "optimal" chunksize and it turns out that (at least on my laptop) the time per edge is minimized with a chunksize of ~1000 (see https://gist.github.com/anntzer/9192485c025933cc233f3a5dc74de936) -- which already seems quite large (even though it is possible to construct contrieved examples, in general I believe that a chunksize larger than the number of pixels (or more specifically, number-of-pixels / simplify-threshold) should cause only few visible artefacts (beyond what path simplification already caused)).

Interestingly, mpl_cairo also exhibits a minimum around 1000 edges, and the time per vertex grows much more sharply after that.

pixel perfect plots, then a value of ``1.0`` can be safely used. If you
want to make sure your plot reflects your data *exactly*, then you should
set ``path.simplify`` to false and/or ``path.simplify_threshold`` to ``0``.
Currently, matplotlib defaults to a convervative value of ``1/9``.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a version of this information should be in the core path documentation so that it is easier to stumble upon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@has2k1 added in most recent commits

@kbrose kbrose force-pushed the performance-helpers branch from b2d135b to ddcbbeb Compare August 14, 2017 21:52
# Using the *fast* style
# ----------------------
#
# The *fast* style that can be used to automatically set
Copy link
Contributor Author

Choose a reason for hiding this comment

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

grammar

# # Setup, and create the data to plot
# y = np.random.rand(100000)
# y[50000:] *= 2
# y[np.logspace(1,np.log10(50000),400).astype(int)] = -1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

spaces after commas

@kbrose kbrose changed the title WIP: New style for fast plotting, updated performance docs New style for fast plotting, updated performance docs Aug 14, 2017
@kbrose kbrose force-pushed the performance-helpers branch from ddcbbeb to d3f6be4 Compare August 15, 2017 03:24
@kbrose kbrose force-pushed the performance-helpers branch from d3f6be4 to 3c27100 Compare August 15, 2017 03:30
@kbrose
Copy link
Contributor Author

kbrose commented Aug 25, 2017

Bump. Any desire to put this in? Or is it just adding noise to the package?

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Aug 25, 2017
@tacaswell tacaswell merged commit 134c06a into matplotlib:master Aug 25, 2017
@tacaswell
Copy link
Member

Thanks for bumping this!

@kbrose kbrose deleted the performance-helpers branch August 25, 2017 03:13
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.

4 participants