Title: sticky_edges behavior is not consistent within/across subpots · Issue #15967 · matplotlib/matplotlib · GitHub
Open Graph Title: sticky_edges behavior is not consistent within/across subpots · Issue #15967 · matplotlib/matplotlib
X Title: sticky_edges behavior is not consistent within/across subpots · Issue #15967 · matplotlib/matplotlib
Description: Bug report Bug summary I am trying to draw lines that do not get a margin placed around them when the axis is autoscaled. My understanding is that the current way to accomplish that is with Artist.sticky_edges. But I am finding that whil...
Open Graph Description: Bug report Bug summary I am trying to draw lines that do not get a margin placed around them when the axis is autoscaled. My understanding is that the current way to accomplish that is with Artist....
X Description: Bug report Bug summary I am trying to draw lines that do not get a margin placed around them when the axis is autoscaled. My understanding is that the current way to accomplish that is with Artist....
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/15967
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sticky_edges behavior is not consistent within/across subpots","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nI am trying to draw lines that do not get a margin placed around them when the axis is autoscaled. My understanding is that the current way to accomplish that is with [`Artist.sticky_edges`](https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.artist.Artist.sticky_edges.html#matplotlib.artist.Artist.sticky_edges). But I am finding that while this works within a single Axes, it does not work across multiple Axes \r\n\r\n**Code for reproduction**\r\n\r\nThis works:\r\n\r\n```python\r\nf, ax = plt.subplots()\r\n\r\nax.scatter([0, 1], [0, 0])\r\nx1 = ax.get_xlim()\r\nline, = ax.plot(x1, [0, 0])\r\nline.sticky_edges.x[:] = x1\r\n\r\nax.scatter([0, 1], [1, 1])\r\nx2 = ax.get_xlim()\r\nline, = ax.plot(x2, [1, 1])\r\nline.sticky_edges.x[:] = x2\r\n\r\nassert x1 == x2\r\n```\r\n\r\nWhile this fails:\r\n\r\n```python\r\nf, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True)\r\n\r\nax1.scatter([0, 1], [0, 0])\r\nx1 = ax1.get_xlim()\r\nline, = ax1.plot(x1, [0, 0])\r\nline.sticky_edges.x[:] = x1\r\n\r\nax2.scatter([0, 1], [1, 1])\r\nx2 = ax2.get_xlim()\r\nline, = ax2.plot(x2, [1, 1])\r\nline.sticky_edges.x[:] = x2\r\n\r\nassert x1 == x2\r\n```\r\n\r\nIs this expected to work? I know there are active changes to the autoscaling behavior; is this a bug that has been fixed (I'm not in a position to test things on a development build right now). Is there a different way to accomplish \"ignore an artist when autoscaling\"?\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: macos\r\n * Matplotlib version: 3.1.1\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): inline\r\n * Python version: 3.7\r\n\r\n","author":{"url":"https://github.com/mwaskom","@type":"Person","name":"mwaskom"},"datePublished":"2019-12-17T20:23:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/15967/matplotlib/issues/15967"}
| 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:e4ef80fa-74b0-e591-8ab3-8ab5795d7d33 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF3E:288515:6B1DE4:8E1D2D:6A5307A7 |
| html-safe-nonce | 6cd38db9c4005d69dd5f890952ba7590a835b99ab29cf56fe6a461e82672a620 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjNFOjI4ODUxNTo2QjFERTQ6OEUxRDJEOjZBNTMwN0E3IiwidmlzaXRvcl9pZCI6Ijc0NDE1NzMxNTA0NDQ0MjMwNzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0bdc29f335e7de87253660b1a1cd14578a3030a8451b2138785270e5cb507bfb |
| hovercard-subject-tag | issue:539290717 |
| 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/15967/issue_layout |
| twitter:image | https://opengraph.githubassets.com/39c8c10a24b20fbcfdd1a8fcdcbdee8774ec13883b8791c81cfab8f9f59875b8/matplotlib/matplotlib/issues/15967 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/39c8c10a24b20fbcfdd1a8fcdcbdee8774ec13883b8791c81cfab8f9f59875b8/matplotlib/matplotlib/issues/15967 |
| og:image:alt | Bug report Bug summary I am trying to draw lines that do not get a margin placed around them when the axis is autoscaled. My understanding is that the current way to accomplish that is with Artist.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mwaskom |
| 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