Title: Second y-axis does not scale correctly when using zoom tool · Issue #9616 · matplotlib/matplotlib · GitHub
Open Graph Title: Second y-axis does not scale correctly when using zoom tool · Issue #9616 · matplotlib/matplotlib
X Title: Second y-axis does not scale correctly when using zoom tool · Issue #9616 · matplotlib/matplotlib
Description: Hello, when making a plot with two differently scaled y-axes by following this example, the second scale becomes incorrect after using the zoom tool (see example below). Interestingly, reading the ylim values (see example below) yields i...
Open Graph Description: Hello, when making a plot with two differently scaled y-axes by following this example, the second scale becomes incorrect after using the zoom tool (see example below). Interestingly, reading the ...
X Description: Hello, when making a plot with two differently scaled y-axes by following this example, the second scale becomes incorrect after using the zoom tool (see example below). Interestingly, reading the ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/9616
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Second y-axis does not scale correctly when using zoom tool","articleBody":"Hello,\r\nwhen making a plot with two differently scaled y-axes by following this [example](https://matplotlib.org/gallery/subplots_axes_and_figures/fahrenheit_celsius_scales.html), the second scale becomes incorrect after using the zoom tool (see example below). Interestingly, reading the `ylim` values (see example below) yields in the expected results. Using ``ax.set_ylim()`` and using the paning tool do not show this behavior.\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\n\r\nfig, ax = plt.subplots()\r\nax.set(title=\"Two y-scales\", ylabel=\"x / m\")\r\n# right ax:\r\naxr = ax.twinx()\r\naxr.set_ylabel(\"x / cm\")\r\n\r\n\r\ndef track_yax(ax_):\r\n \"\"\"Syncronize second y-axis with first axis. \"\"\"\r\n y1, y2 = ax.get_ylim()\r\n axr.set_ylim(100*y1, y2*100)\r\n # axr.figure.canvas.draw() # does not make a difference\r\n yr1, yr2 = axr.get_ylim()\r\n print(f\"Lower: {y1:+.5g} -> {yr1:+.5g}\\t Upper: {y2:+.5g} -> {yr2:+.5g}\")\r\n\r\n\r\n# automatically update ylim of ax2 when ylim of ax1 changes.\r\nax.callbacks.connect(\"ylim_changed\", track_yax)\r\n\r\n\r\n# Do the plotting:\r\nax.plot([0, 5, 2, 4, 1], 'o-')\r\nax.grid(True)\r\n\r\nplt.show()\r\n```\r\n\r\n\r\n\r\n**Matplotlib version**\r\n\r\n * Operating system: Debian 4.13.4-2 (Sid) x86_64 GNU/Linux\r\n * Matplotlib version: 2.1.0.post484.dev0+g883096231 (git master)\r\n * Matplotlib backend: Qt5Agg \r\n * Python version: Python 3.6.3 on Anaconda 5.0.1 \r\n ","author":{"url":"https://github.com/DietBru","@type":"Person","name":"DietBru"},"datePublished":"2017-10-29T18:37:33Z","url":"https://github.com/matplotlib/matplotlib/issues/9616"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:60567ed7-7ba8-4c37-91b8-dde8a1324b41 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA4C:804E:115C5B8:1706F8C:6B0654BC |
| html-safe-nonce | 9d10c08a2e6bbd5134742f97cff3bd817500de726453e46cf3342fd2fb5b2565 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTRDOjgwNEU6MTE1QzVCODoxNzA2RjhDOjZCMDY1NEJDIiwidmlzaXRvcl9pZCI6IjQ2ODMxMTU5MTMzODA1MTcwNTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4e30a100e76706f2c20de3db75aad8edce4f4b14772d1d62de330135be3cdc73 |
| hovercard-subject-tag | issue:269423222 |
| 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/9616/issue_layout |
| twitter:image | https://opengraph.githubassets.com/391402cd2253f1e2968d7ee56eaeb42dead45bd9714e14e2810107068907144d/matplotlib/matplotlib/issues/9616 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/391402cd2253f1e2968d7ee56eaeb42dead45bd9714e14e2810107068907144d/matplotlib/matplotlib/issues/9616 |
| og:image:alt | Hello, when making a plot with two differently scaled y-axes by following this example, the second scale becomes incorrect after using the zoom tool (see example below). Interestingly, reading the ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DietBru |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6324e6ac990fb6befbec840cc0e102a1071c339bfe8f9826bb12de2e3ba1d297 |
| 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 | 7f0aa75f4141d440c6110dc31af7ea7797abb6c4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width