Title: LogNorm on empty image fails · Issue #9194 · matplotlib/matplotlib · GitHub
Open Graph Title: LogNorm on empty image fails · Issue #9194 · matplotlib/matplotlib
X Title: LogNorm on empty image fails · Issue #9194 · matplotlib/matplotlib
Description: Bug report Bug summary ax.imshow([[]], norm=LogNorm()) does not work but ax.imshow([[]]) does. Code for reproduction import matplotlib.pyplot as plt from matplotlib.colors import LogNorm fig, ax = plt.subplots(1, 1) ax.imshow([[]]) # doe...
Open Graph Description: Bug report Bug summary ax.imshow([[]], norm=LogNorm()) does not work but ax.imshow([[]]) does. Code for reproduction import matplotlib.pyplot as plt from matplotlib.colors import LogNorm fig, ax = ...
X Description: Bug report Bug summary ax.imshow([[]], norm=LogNorm()) does not work but ax.imshow([[]]) does. Code for reproduction import matplotlib.pyplot as plt from matplotlib.colors import LogNorm fig, ax = ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/9194
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"LogNorm on empty image fails","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\n`ax.imshow([[]], norm=LogNorm())` does not work but `ax.imshow([[]])` does.\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nfrom matplotlib.colors import LogNorm\r\nfig, ax = plt.subplots(1, 1)\r\nax.imshow([[]]) # doesn't fail\r\nax.imshow([[]], norm=LogNorm) # fails\r\n```\r\n\r\n**Actual outcome**\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nValueError Traceback (most recent call last)\r\n\u003cipython-input-4-dc293e10dd21\u003e in \u003cmodule\u003e()\r\n----\u003e 1 ax.imshow([[]], norm=LogNorm())\r\n\r\n/home/christopher/mc/envs/dp_dev/lib/python3.5/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)\r\n 1896 warnings.warn(msg % (label_namer, func.__name__),\r\n 1897 RuntimeWarning, stacklevel=2)\r\n-\u003e 1898 return func(ax, *args, **kwargs)\r\n 1899 pre_doc = inner.__doc__\r\n 1900 if pre_doc is None:\r\n\r\n/home/christopher/mc/envs/dp_dev/lib/python3.5/site-packages/matplotlib/axes/_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)\r\n 5132 im.set_clim(vmin, vmax)\r\n 5133 else:\r\n-\u003e 5134 im.autoscale_None()\r\n 5135 im.set_url(url)\r\n 5136 \r\n\r\n/home/christopher/mc/envs/dp_dev/lib/python3.5/site-packages/matplotlib/cm.py in autoscale_None(self)\r\n 343 if self._A is None:\r\n 344 raise TypeError('You must first set_array for mappable')\r\n--\u003e 345 self.norm.autoscale_None(self._A)\r\n 346 self.changed()\r\n 347 \r\n\r\n/home/christopher/mc/envs/dp_dev/lib/python3.5/site-packages/matplotlib/colors.py in autoscale_None(self, A)\r\n 962 A = ma.masked_less_equal(A, 0, copy=False)\r\n 963 if self.vmin is None:\r\n--\u003e 964 self.vmin = ma.min(A)\r\n 965 if self.vmax is None:\r\n 966 self.vmax = ma.max(A)\r\n\r\n/home/christopher/mc/envs/dp_dev/lib/python3.5/site-packages/numpy/ma/core.py in min(obj, axis, out, fill_value, keepdims)\r\n 6300 \r\n 6301 try:\r\n-\u003e 6302 return obj.min(axis=axis, fill_value=fill_value, out=out, **kwargs)\r\n 6303 except (AttributeError, TypeError):\r\n 6304 # If obj doesn't have a min method, or if the method doesn't accept a\r\n\r\n/home/christopher/mc/envs/dp_dev/lib/python3.5/site-packages/numpy/ma/core.py in min(self, axis, out, fill_value, keepdims)\r\n 5470 if out is None:\r\n 5471 result = self.filled(fill_value).min(\r\n-\u003e 5472 axis=axis, out=out, **kwargs).view(type(self))\r\n 5473 if result.ndim:\r\n 5474 # Set the mask\r\n\r\n/home/christopher/mc/envs/dp_dev/lib/python3.5/site-packages/numpy/core/_methods.py in _amin(a, axis, out, keepdims)\r\n 27 \r\n 28 def _amin(a, axis=None, out=None, keepdims=False):\r\n---\u003e 29 return umr_minimum(a, axis, None, out, keepdims)\r\n 30 \r\n 31 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):\r\n\r\n```\r\n\r\n**Expected outcome**\r\nSimilar to the not log norm version display an empty plot.\r\n\r\n**Matplotlib version**\r\n * Operating System: Ubuntu 16.04\r\n * Matplotlib Version: matplotlib 2.0.2 np111py35_0 conda-forge\r\n * Python Version: 3.5\r\n","author":{"url":"https://github.com/CJ-Wright","@type":"Person","name":"CJ-Wright"},"datePublished":"2017-09-17T00:39:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/9194/matplotlib/issues/9194"}
| 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:947bc7c3-9bc8-bed0-8c49-ac05988fb746 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE68:339F37:1F33B58:2D579D1:6A54F074 |
| html-safe-nonce | e24ed891f3fef6aef4fa8fb2db170a843a7a3fd0909300ae559fd2a53210194b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTY4OjMzOUYzNzoxRjMzQjU4OjJENTc5RDE6NkE1NEYwNzQiLCJ2aXNpdG9yX2lkIjoiODY5MTUzMDA4NTU0MTQzODYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2a7744f5d56312bec54cb0cf46c9a9dcb78ba2141d16e8fcb3a26d0ba3d1a73c |
| hovercard-subject-tag | issue:258268680 |
| 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/9194/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ab626aa629343b0464451c68cbdb8acd8503ffc539d220c9776dd75419b7f67f/matplotlib/matplotlib/issues/9194 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ab626aa629343b0464451c68cbdb8acd8503ffc539d220c9776dd75419b7f67f/matplotlib/matplotlib/issues/9194 |
| og:image:alt | Bug report Bug summary ax.imshow([[]], norm=LogNorm()) does not work but ax.imshow([[]]) does. Code for reproduction import matplotlib.pyplot as plt from matplotlib.colors import LogNorm fig, ax = ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CJ-Wright |
| hostname | github.com |
| expected-hostname | github.com |
| None | eae2aab99907699a22d2c8449aa683ca74454fca87211b98f7c7b722086b2839 |
| 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 | dd26d3896747463b6bd56edd5e290edb595c3cbc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width