Title: Improve autoscaling for high order Bezier curves by dstansby · Pull Request #19214 · matplotlib/matplotlib · GitHub
Open Graph Title: Improve autoscaling for high order Bezier curves by dstansby · Pull Request #19214 · matplotlib/matplotlib
X Title: Improve autoscaling for high order Bezier curves by dstansby · Pull Request #19214 · matplotlib/matplotlib
Description: Overview Currently every control point is used when autoscaling with a Bezier curve, but for high order curves this isn't desired, as control points that aren't the start or end point do not lie on the actual curve. A better way to calculate points for autoscaling is to include the start point, end point, and any extrema on the curve. This PR introduces a new method to convert a path from a set of Bezier segments to straight lines connecting the start, extrema, and end points. The bounding box of these points is then the bounding box of the overall Path, so it can be used for autoscaling. This leverages the new functionality in #16832 introduced to properly calculate the bounding box of a complex Bezier curve, and makes sure it is used in the autoscaling. Fixes #19174 Example from matplotlib.path import Path from matplotlib.patches import PathPatch import matplotlib.pyplot as plt verts = [[-1, 0], [0, -1], [1, 0], [1, 0]] codes = [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY] p = Path(verts, codes) fig, ax = plt.subplots() ax.add_patch(PathPatch(p)) ax.autoscale() plt.show() Before: After:
Open Graph Description: Overview Currently every control point is used when autoscaling with a Bezier curve, but for high order curves this isn't desired, as control points that aren't the start or end point do no...
X Description: Overview Currently every control point is used when autoscaling with a Bezier curve, but for high order curves this isn't desired, as control points that aren't the start or end poi...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/19214
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3f0a7c07-f007-fce9-c043-af4cc338d2e0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CF4A:378132:5144DD:6F08B9:6A511DEC |
| html-safe-nonce | e465d95bc88eed781726bd97e2550e55618cd9cf8b339e2ecf643d3c5e9022f8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjRBOjM3ODEzMjo1MTQ0REQ6NkYwOEI5OjZBNTExREVDIiwidmlzaXRvcl9pZCI6IjM0NTA0MzAyODE4OTAyMDkyNjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 965feb689d96e30d578d9913c781f5829d0d89336f4adab7d593f7abbfa0ba7a |
| hovercard-subject-tag | pull_request:547677791 |
| 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/19214/files |
| twitter:image | https://avatars.githubusercontent.com/u/6197628?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/6197628?s=400&v=4 |
| og:image:alt | Overview Currently every control point is used when autoscaling with a Bezier curve, but for high order curves this isn't desired, as control points that aren't the start or end point do no... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | f0f0f3a40c5b69803a8255a8e44323880bf9c4db54d5c076f2130bedf2a1dde5 |
| 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 | 44909533816f7f99ff04e7a0fe692733af67ed84 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width