Title: ENH: secondary axis for a x or y scale. · Issue #10976 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH: secondary axis for a x or y scale. · Issue #10976 · matplotlib/matplotlib
X Title: ENH: secondary axis for a x or y scale. · Issue #10976 · matplotlib/matplotlib
Description: Enhancement discussion See #10961 #10960 Often it is desirable to have a second x or y scale on an axes with a different scale than the primary x/y axis; think frequency and period on the xaxis of a power spectrum, or date and datenum fo...
Open Graph Description: Enhancement discussion See #10961 #10960 Often it is desirable to have a second x or y scale on an axes with a different scale than the primary x/y axis; think frequency and period on the xaxis of ...
X Description: Enhancement discussion See #10961 #10960 Often it is desirable to have a second x or y scale on an axes with a different scale than the primary x/y axis; think frequency and period on the xaxis of ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/10976
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ENH: secondary axis for a x or y scale. ","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Enhancement discussion\r\n\r\nSee #10961 #10960 \r\n\r\n\r\n\r\n\r\nOften it is desirable to have a second x or y scale on an axes with a different scale than the primary x/y axis; think frequency and period on the xaxis of a power spectrum, or date and datenum for a time series. (just assuming the x-axis for now:) Generally it'd be the same size as the existing xaxis, but would be offset vertically, have its own locator, formatter, and xlabel. it would update as the data is zoomed through, and be slave to the parent xaxis\r\n\r\nIt appears folks most often do this with twiny (i.e. https://stackoverflow.com/questions/10514315/how-to-add-a-second-x-axis-in-matplotlib) but there is nothing to make the axes continue to have the same x-limits under interactive viewing, and no simple way to have the new axes have a different scale. \r\n\r\nThe enhancement here would be to add something like:\r\n\r\n```\r\nsecaxis = ax.secondary_xaxis(loc='top', convert=5, label='Boo')\r\n```\r\n\r\nwhere `secaxis` is either an axis object or an axes. `loc` would be something like `\"top\", \"bottom\", \"above\", \"below\", float` where \"above\" and \"below\" means that it goes above or below any existing axis, and the float is a hard-set axes fraction (like the `set_position` of `spine` now). `convert` would be a conversion factor: a float would just be a multiplier, or a function could be passed that converts x to xnew. No doubt there could be a way to make this work with units instead, but...\r\n \r\n#### How to impliment\r\n\r\nAs discussed in #10961 @efiring thought implimenting as an axes with shrunk and hidden unused dimensions would be good. \r\n\r\nI'd advocate an axis object so that the logical organization makes more sense. i.e. this would be a child of the original axes, and would be included as one of the axes decorators. But, I haven't thought through all the implimentation details yet. \r\n\r\n","author":{"url":"https://github.com/jklymak","@type":"Person","name":"jklymak"},"datePublished":"2018-04-06T20:42:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/10976/matplotlib/issues/10976"}
| 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:4f350428-3620-3a44-8517-2790acb94cee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD22:2AB90B:4C4125:661C93:6A52FE83 |
| html-safe-nonce | 21d052bf2b20a7902bd287ca0a5f15ad4faf27637b4e8675e4eebe1258814a7c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDIyOjJBQjkwQjo0QzQxMjU6NjYxQzkzOjZBNTJGRTgzIiwidmlzaXRvcl9pZCI6IjE4NDQ2MzEwNDg4ODI5NDU2NjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 472edec7fb1391aa6f9627d92eb522ca8fc5cdf2351369e9357e9d0b9ad69396 |
| hovercard-subject-tag | issue:312111085 |
| 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/10976/issue_layout |
| twitter:image | https://opengraph.githubassets.com/890125bd89aeca1b36630df174b80560f9024692cefe3d41a78bf8c84b58c6f6/matplotlib/matplotlib/issues/10976 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/890125bd89aeca1b36630df174b80560f9024692cefe3d41a78bf8c84b58c6f6/matplotlib/matplotlib/issues/10976 |
| og:image:alt | Enhancement discussion See #10961 #10960 Often it is desirable to have a second x or y scale on an axes with a different scale than the primary x/y axis; think frequency and period on the xaxis of ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jklymak |
| 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