Title: ENH: Possibilty to pass absolute values to axhline and axvline · Issue #15586 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH: Possibilty to pass absolute values to axhline and axvline · Issue #15586 · matplotlib/matplotlib
X Title: ENH: Possibilty to pass absolute values to axhline and axvline · Issue #15586 · matplotlib/matplotlib
Description: Dear developers, I have a enhancement proposal: Could you please add the possibility to pass absolute values to axhline and axvline? Background I found it a bit inconvenient to draw horizontal or vertical lines to mark maxima or minima u...
Open Graph Description: Dear developers, I have a enhancement proposal: Could you please add the possibility to pass absolute values to axhline and axvline? Background I found it a bit inconvenient to draw horizontal or v...
X Description: Dear developers, I have a enhancement proposal: Could you please add the possibility to pass absolute values to axhline and axvline? Background I found it a bit inconvenient to draw horizontal or v...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/15586
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ENH: Possibilty to pass absolute values to axhline and axvline","articleBody":"Dear developers,\r\n\r\nI have a enhancement proposal: Could you please add the possibility to pass absolute values to axhline and axvline?\r\n\r\n**Background**\r\nI found it a bit inconvenient to draw horizontal or vertical lines to mark maxima or minima using the relative values if you are plotting actual data.\r\n\r\n**Code example**\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\nfig, ax = plt.subplots()\r\nx = np.linspace(-1, 1)\r\ndef curve(x):\r\n return -np.random.rand()*(2)*x**2-np.random.rand() # the random numbers have just been introduced to avoid an easy guessing of the numbers in the following\r\n\r\nfixed_curve = curve(x)\r\nax.plot(x, fixed_curve)\r\nylim = ax.get_ylim()\r\nytmp = (np.amax(fixed_curve) - ylim[0])/(ylim[1]-ylim[0])\r\nax.axvline(0, 0, ytmp) # better(?): ax.axvline(0, ylim[0], np.amax(fixed_curve), absolute = True)\r\n```\r\n\r\n**Code explanation**\r\nIn the example given above I want to mark to maximum with the coordinates (x, y) by a vertical line going from the maximum of the curve to the x axis to mark the value on the x axis. However, to exactly hit the maximum I first have to calculate the position of the maximum in respect the limits of the plot. Otherwise the line does either not \"reach\" the maximum or it \"crosses\" the maximum what would be counterintuitive.\r\nThis could be shortened by a parameter `absolute` or similar that allows you to draw a `axvline` or `axhline` from one absolute coordinate to another absolute coordinate.\r\n\r\nWhat do you think about that suggestion?\r\n\r\n\r\nRegards\r\n\r\nJakob","author":{"url":"https://github.com/jakobjakobson13","@type":"Person","name":"jakobjakobson13"},"datePublished":"2019-11-01T16:57:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/15586/matplotlib/issues/15586"}
| 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:941a85ca-2843-bbea-b1f6-7bcda267d518 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C94A:2FB335:6BD79F:9116A5:6A526D3B |
| html-safe-nonce | 31bda53e436c51a0ef8fa96fc93ca12b16d801cc5337e0eeda8521fd7cc324d3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTRBOjJGQjMzNTo2QkQ3OUY6OTExNkE1OjZBNTI2RDNCIiwidmlzaXRvcl9pZCI6IjQ2NjUwNDcwNDYwODM5OTY5ODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ea34148573f92b7fc8cecd95bcd96d7754ae5db3083ee8f44221cb163b849293 |
| hovercard-subject-tag | issue:516232463 |
| 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/15586/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f1b3f644b54c7e0f74b1e2f2ec5dfc20ba51cab0df50f3c2dcc19ceb8e3c0093/matplotlib/matplotlib/issues/15586 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f1b3f644b54c7e0f74b1e2f2ec5dfc20ba51cab0df50f3c2dcc19ceb8e3c0093/matplotlib/matplotlib/issues/15586 |
| og:image:alt | Dear developers, I have a enhancement proposal: Could you please add the possibility to pass absolute values to axhline and axvline? Background I found it a bit inconvenient to draw horizontal or v... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jakobjakobson13 |
| 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