Title: axhline/axvline broken with pint.Quantity · Issue #8910 · matplotlib/matplotlib · GitHub
Open Graph Title: axhline/axvline broken with pint.Quantity · Issue #8910 · matplotlib/matplotlib
X Title: axhline/axvline broken with pint.Quantity · Issue #8910 · matplotlib/matplotlib
Description: With matplotlib 2.0.2, you can't use pint.Quantity with axhline or axvline: %matplotlib inline import matplotlib.pyplot as plt import pint units = pint.UnitRegistry() fig, axes = plt.subplots(1, 1) axes.axhline(0 * units.meter) yields: -...
Open Graph Description: With matplotlib 2.0.2, you can't use pint.Quantity with axhline or axvline: %matplotlib inline import matplotlib.pyplot as plt import pint units = pint.UnitRegistry() fig, axes = plt.subplots(1, 1)...
X Description: With matplotlib 2.0.2, you can't use pint.Quantity with axhline or axvline: %matplotlib inline import matplotlib.pyplot as plt import pint units = pint.UnitRegistry() fig, axes = plt.subplots(1...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/8910
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"axhline/axvline broken with pint.Quantity","articleBody":"With matplotlib 2.0.2, you can't use pint.Quantity with `axhline` or `axvline`:\r\n```python\r\n%matplotlib inline\r\n\r\nimport matplotlib.pyplot as plt\r\nimport pint\r\n\r\nunits = pint.UnitRegistry()\r\nfig, axes = plt.subplots(1, 1)\r\naxes.axhline(0 * units.meter)\r\n```\r\nyields:\r\n```pytb\r\n\r\n---------------------------------------------------------------------------\r\nValueError Traceback (most recent call last)\r\n\u003cipython-input-3-b77d6298b805\u003e in \u003cmodule\u003e()\r\n 6 units = pint.UnitRegistry()\r\n 7 fig, axes = plt.subplots(1, 1)\r\n----\u003e 8 axes.axhline(0 * units.meter)\r\n\r\n~/miniconda3/envs/py36/lib/python3.6/site-packages/matplotlib/axes/_axes.py in axhline(self, y, xmin, xmax, **kwargs)\r\n 720 self._process_unit_info(ydata=y, kwargs=kwargs)\r\n 721 yy = self.convert_yunits(y)\r\n--\u003e 722 scaley = (yy \u003c ymin) or (yy \u003e ymax)\r\n 723 \r\n 724 trans = self.get_yaxis_transform(which='grid')\r\n\r\n~/miniconda3/envs/py36/lib/python3.6/site-packages/pint/quantity.py in \u003clambda\u003e(self, other)\r\n 1075 other.to_root_units().magnitude)\r\n 1076 \r\n-\u003e 1077 __lt__ = lambda self, other: self.compare(other, op=operator.lt)\r\n 1078 __le__ = lambda self, other: self.compare(other, op=operator.le)\r\n 1079 __ge__ = lambda self, other: self.compare(other, op=operator.ge)\r\n\r\n~/miniconda3/envs/py36/lib/python3.6/site-packages/pint/quantity.py in compare(self, other, op)\r\n 1065 return op(self._convert_magnitude_not_inplace(UnitsContainer()), other)\r\n 1066 else:\r\n-\u003e 1067 raise ValueError('Cannot compare Quantity and {0}'.format(type(other)))\r\n 1068 \r\n 1069 if self._units == other._units:\r\n\r\nValueError: Cannot compare Quantity and \u003cclass 'numpy.float64'\u003e\r\n```","author":{"url":"https://github.com/dopplershift","@type":"Person","name":"dopplershift"},"datePublished":"2017-07-18T22:25:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/8910/matplotlib/issues/8910"}
| 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:b90365dd-8072-8945-12ec-06bae1600e80 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E30:395F1C:A6BF9:DCEBF:6A52B529 |
| html-safe-nonce | a61dbb40b878e6109f40c80a5f34ae763db0691619995b6c0680570f07d7abd5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTMwOjM5NUYxQzpBNkJGOTpEQ0VCRjo2QTUyQjUyOSIsInZpc2l0b3JfaWQiOiI4MzY4MTQ3NTU0OTc0NzQxODAxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 25ac5ff58e116a89362a9d5b0bda74b37a75ea710d2bcc69ab6c4260271800a0 |
| hovercard-subject-tag | issue:243869641 |
| 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/8910/issue_layout |
| twitter:image | https://opengraph.githubassets.com/23bb86dd7dec6acc4b9ffa37649420402d4a7a24f36a262aca07cfa61e3bf066/matplotlib/matplotlib/issues/8910 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/23bb86dd7dec6acc4b9ffa37649420402d4a7a24f36a262aca07cfa61e3bf066/matplotlib/matplotlib/issues/8910 |
| og:image:alt | With matplotlib 2.0.2, you can't use pint.Quantity with axhline or axvline: %matplotlib inline import matplotlib.pyplot as plt import pint units = pint.UnitRegistry() fig, axes = plt.subplots(1, 1)... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dopplershift |
| 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