Title: Only autoscale_view() when needed, not after every plotting call. by anntzer · Pull Request #13593 · matplotlib/matplotlib · GitHub
Open Graph Title: Only autoscale_view() when needed, not after every plotting call. by anntzer · Pull Request #13593 · matplotlib/matplotlib
X Title: Only autoscale_view() when needed, not after every plotting call. by anntzer · Pull Request #13593 · matplotlib/matplotlib
Description: Closes the first half of #7413 (you may want to read that first). Closes #12542. This avoids quadratic complexity when accumulating sticky edges. Mostly, this just replaces autoscale_view() calls with setting a flag requesting that autoscale_view() be called the next time viewLim is accessed. Note that we cannot just do this in draw as this would break common idioms like ax.plot(...) ax.set_xlim(0, None) # keep top limit to what plot() set The main nontrivial changes are Removal of sticky_edges from hexbin(): Previously, hexbin() actually did not respect the sticky_egdes settings for some reason (this can be checked visually); but with this patch it would respect them -- breaking the baseline images. So just don't set sticky_edges instead. Making LinearLocator.numticks a property: Previously, some code using LinearLocator would only work after the locator has been used once, so that tick_values properly set numticks to not-None; but with this patch, tick_values is no longer called early enough; making numticks a property fixes that. Note that LinearLocator is likely extremely rarely used anyways... In test_bbox_inches_tight (which uses the old "round_numbers" autolimits mode), the autolimits change depending on whether autoscaling happens before the call to xticks([]) (old behavior) or after (because there's no notion of "round numbers" anymore. Here we can just force these limits. test_multi_color_hatch relied on ax.bar() triggering an autoscale but ax.add_patch not doing so. Just disable autoscaling then. This patch also prepares towards fixing collections autoscaling problems when switching from linear to log scales (as that also needs to be deferred to as late as possible, once the scale is actually known). (i.e., work towards the second half of #7413, not that I have a complete plan yet.) On the example in #12542, this version is ~35% faster than on 1.5.3 (which is the last version before quadratic behavior was introduced). Obviously a lot of other things changed since then, though. PR Summary 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
Open Graph Description: Closes the first half of #7413 (you may want to read that first). Closes #12542. This avoids quadratic complexity when accumulating sticky edges. Mostly, this just replaces autoscale_view() calls ...
X Description: Closes the first half of #7413 (you may want to read that first). Closes #12542. This avoids quadratic complexity when accumulating sticky edges. Mostly, this just replaces autoscale_view() calls ...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/13593
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:fbfe4a27-6cb8-740a-442d-a19ce8c8f852 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E742:1E3BF:6550CF:88084D:6A541403 |
| html-safe-nonce | c4557733c75fb40511ab678af86a5b9aed1f52a4f680f791d90cecc403302cc8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzQyOjFFM0JGOjY1NTBDRjo4ODA4NEQ6NkE1NDE0MDMiLCJ2aXNpdG9yX2lkIjoiNjAyMDE3OTYyNjc4MTA1Mzk1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 799855b4f908396f32a26b884275f2b5e40c1eb8376ca2dafb8d1fdf694c3222 |
| hovercard-subject-tag | pull_request:258269644 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/13593/files |
| twitter:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| og:image:alt | Closes the first half of #7413 (you may want to read that first). Closes #12542. This avoids quadratic complexity when accumulating sticky edges. Mostly, this just replaces autoscale_view() calls ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width