Title: Off-axes markers unnecessarily saved to PDF by mdboom · Pull Request #2423 · matplotlib/matplotlib · GitHub
Open Graph Title: Off-axes markers unnecessarily saved to PDF by mdboom · Pull Request #2423 · matplotlib/matplotlib
X Title: Off-axes markers unnecessarily saved to PDF by mdboom · Pull Request #2423 · matplotlib/matplotlib
Description: Plotting a bunch of markers without lines, then changing the axes limits so none of the points are visible, and then saving the result to a PDF, results in a file just as big as if the markers were all visible within their default axes limits. This doesn't happen for line only plots. I guess the PDF backend clips the lines before deciding what to save to file, but it doesn't clip the markers. Not only does this result in an unnecessarily large PDF file (and potentially a security issue, because data is unintentionally leaking out), but rendering that file in a PDF viewer can be a lot slower as well. Here's some demo code: import numpy as np x = np.random.random(20000) y = np.random.random(20000) figure() plot(x, y, 'k.') # use markers only pyplot.savefig('dots.pdf') xlim(2, 3) # move axes away for empty plot pyplot.savefig('dots_empty.pdf') ''' file sizes in bytes: dots.pdf: 327505 dots_empty.pdf: 327921 ''' figure() plot(x, y, 'k-') # use lines only pyplot.savefig('lines.pdf') xlim(2, 3) # move axes away for empty plot pyplot.savefig('lines_empty.pdf') ''' file sizes in bytes: lines.pdf: 310071 lines_empty.pdf: 5905 '''
Open Graph Description: Plotting a bunch of markers without lines, then changing the axes limits so none of the points are visible, and then saving the result to a PDF, results in a file just as big as if the markers were...
X Description: Plotting a bunch of markers without lines, then changing the axes limits so none of the points are visible, and then saving the result to a PDF, results in a file just as big as if the markers were...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/2423
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:53598d0f-4a41-5e4b-bd22-a27a33d8697a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A5C4:3A68A9:32C9931:45FA646:6A508797 |
| html-safe-nonce | 1ba17ae0173b31931cf2a0662e81b843134be5c7a2555b15afcf88bf451621b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUM0OjNBNjhBOTozMkM5OTMxOjQ1RkE2NDY6NkE1MDg3OTciLCJ2aXNpdG9yX2lkIjoiODQ5NDQ0MzI0NTg2MTg5ODEzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5f17b633da4061c9962fdc4f703fdd6d7356eba97ec79bfacc506cf95842e725 |
| hovercard-subject-tag | pull_request:8756262 |
| 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/2423/files |
| twitter:image | https://avatars.githubusercontent.com/u/38294?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/38294?s=400&v=4 |
| og:image:alt | Plotting a bunch of markers without lines, then changing the axes limits so none of the points are visible, and then saving the result to a PDF, results in a file just as big as if the markers were... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| 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 | 7ac0ad2f2c7e4b9056617355fd9e33e22b0c8df9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width