Title: Should zero-sized Rectangles be taken into account for autoscaling purposes? · Issue #19081 · matplotlib/matplotlib · GitHub
Open Graph Title: Should zero-sized Rectangles be taken into account for autoscaling purposes? · Issue #19081 · matplotlib/matplotlib
X Title: Should zero-sized Rectangles be taken into account for autoscaling purposes? · Issue #19081 · matplotlib/matplotlib
Description: Currently, Rectangles with zero-width and zero-height are ignored for autoscaling purposes, but not other zero-sized patches: from matplotlib import patches, pyplot as plt ax = plt.figure().add_subplot() ax.add_patch(patches.Rectangle((-...
Open Graph Description: Currently, Rectangles with zero-width and zero-height are ignored for autoscaling purposes, but not other zero-sized patches: from matplotlib import patches, pyplot as plt ax = plt.figure().add_sub...
X Description: Currently, Rectangles with zero-width and zero-height are ignored for autoscaling purposes, but not other zero-sized patches: from matplotlib import patches, pyplot as plt ax = plt.figure().add_sub...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/19081
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Should zero-sized Rectangles be taken into account for autoscaling purposes?","articleBody":"Currently, Rectangles with zero-width and zero-height are ignored for autoscaling purposes, but not other zero-sized patches:\r\n```python\r\nfrom matplotlib import patches, pyplot as plt\r\n\r\nax = plt.figure().add_subplot()\r\nax.add_patch(patches.Rectangle((-5, -5), 0, 0)) # zero-sized at (-5, -5)\r\nax.add_patch(patches.Circle((5, 5), 0)) # zero-radius at (5, 5)\r\nax.relim()\r\nax.autoscale_view()\r\nplt.show()\r\n```\r\nresults in axes autoscaled around (5, 5) (so they include the circle, but not the rectangle). I would argue that Rectangles should never be ignored, even if they have zero-width and zero-height, both for consistency with other patches, and because such Rectangles are likely not drawn with no reason.\r\n\r\nThis behavior (implemented in `Axes._update_patch_limits`) was introduced in f24d06c to support log-scaled histograms with empty bins, but is not necessary anymore as hist autoscaling was fully reworked in #14581, making this behavior unnecessary (the check in `_update_patch_limits` can be deleted with no bad effects); perhaps it was even already unnecessary before though.\r\n\r\nAlso, note that #2942 already weakened the original patch by going from ignoring Rectangles with zero width OR height to only ignoring Rectangles with zero width and height.","author":{"url":"https://github.com/anntzer","@type":"Person","name":"anntzer"},"datePublished":"2020-12-07T22:49:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/19081/matplotlib/issues/19081"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3aeb125f-d744-f280-0769-ffc0a84cf2b0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CBB2:2D56E3:3D5B8:4FFB3:6A52E88C |
| html-safe-nonce | c752f45c29825f36ac85691e5133a201dce9c57f432b4719941fd774bf0cb936 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkIyOjJENTZFMzozRDVCODo0RkZCMzo2QTUyRTg4QyIsInZpc2l0b3JfaWQiOiI2MDk2NDQwNzAxMDE2NTMzMTMyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4697dc9130dd1edce3cca1d4b11d93b774dee6dd3074afa62a3b0522b68da72b |
| hovercard-subject-tag | issue:758910423 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/matplotlib/matplotlib/19081/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2ac5a9479e4ba6d747b051c6f79ace40ee297981789ae32db6adb42f2ce71bf1/matplotlib/matplotlib/issues/19081 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2ac5a9479e4ba6d747b051c6f79ace40ee297981789ae32db6adb42f2ce71bf1/matplotlib/matplotlib/issues/19081 |
| og:image:alt | Currently, Rectangles with zero-width and zero-height are ignored for autoscaling purposes, but not other zero-sized patches: from matplotlib import patches, pyplot as plt ax = plt.figure().add_sub... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anntzer |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| 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