Title: get error when show a picture(image) : 'numpy.ndarray' object has no attribute 'mask' · Issue #10616 · matplotlib/matplotlib · GitHub
Open Graph Title: get error when show a picture(image) : 'numpy.ndarray' object has no attribute 'mask' · Issue #10616 · matplotlib/matplotlib
X Title: get error when show a picture(image) : 'numpy.ndarray' object has no attribute 'mask' · Issue #10616 · matplotlib/matplotlib
Description: Hi I was using python3.5.2, numpy 1.14.1, and matplotlib 2.1.2 and encountered a problem when I attempted to show a picture with pyplot. It always gave errors saying 'numpy.ndarray object has no attribute mask', and the related source co...
Open Graph Description: Hi I was using python3.5.2, numpy 1.14.1, and matplotlib 2.1.2 and encountered a problem when I attempted to show a picture with pyplot. It always gave errors saying 'numpy.ndarray object has no at...
X Description: Hi I was using python3.5.2, numpy 1.14.1, and matplotlib 2.1.2 and encountered a problem when I attempted to show a picture with pyplot. It always gave errors saying 'numpy.ndarray object has n...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/10616
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"get error when show a picture(image) : 'numpy.ndarray' object has no attribute 'mask'","articleBody":"\r\nHi\r\n\r\nI was using python3.5.2, numpy 1.14.1, and matplotlib 2.1.2 and encountered a problem when I attempted to show a picture with pyplot. It always gave errors saying 'numpy.ndarray object has no attribute mask', and the related source code seemed in 'matplotlib/image.py'.\r\n\r\nI'm not sure whether it was caused by matplotlib or numpy. How do I fix this ?\r\n\r\n```shell\r\n$ python3\r\nPython 3.5.2 (default, Nov 23 2017, 16:37:01) \r\n[GCC 5.4.0 20160609] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n\u003e\u003e\u003e import matplotlib.pyplot as plt\r\n\u003e\u003e\u003e from PIL import Image\r\n\u003e\u003e\u003e img=Image.open('test.jpg')\r\n\u003e\u003e\u003e imgfig = plt.figure()\r\n\u003e\u003e\u003e imgplt = imgfig.add_subplot(111)\r\n\u003e\u003e\u003e imgplt.imshow(img)\r\n\u003cmatplotlib.image.AxesImage object at 0x7ff142877438\u003e\r\n\u003e\u003e\u003e plt.show()\r\nException in Tkinter callback\r\nTraceback (most recent call last):\r\n File \"/usr/lib/python3.5/tkinter/__init__.py\", line 1553, in __call__\r\n return self.func(*args)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py\", line 233, in resize\r\n self.show()\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py\", line 304, in draw\r\n FigureCanvasAgg.draw(self)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_agg.py\", line 430, in draw\r\n self.figure.draw(self.renderer)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py\", line 1299, in draw\r\n renderer, self, artists, self.suppressComposite)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/axes/_base.py\", line 2437, in draw\r\n mimage._draw_list_compositing_images(renderer, self, artists)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 566, in draw\r\n renderer, renderer.get_image_magnification())\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 793, in make_image\r\n unsampled=unsampled)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 430, in _make_image\r\n if A.mask.shape == A.shape:\r\nAttributeError: 'numpy.ndarray' object has no attribute 'mask'\r\nException in Tkinter callback\r\nTraceback (most recent call last):\r\n File \"/usr/lib/python3.5/tkinter/__init__.py\", line 1553, in __call__\r\n return self.func(*args)\r\n File \"/usr/lib/python3.5/tkinter/__init__.py\", line 599, in callit\r\n func(*args)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py\", line 323, in idle_draw\r\n self.draw()\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py\", line 304, in draw\r\n FigureCanvasAgg.draw(self)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_agg.py\", line 430, in draw\r\n self.figure.draw(self.renderer)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py\", line 1299, in draw\r\n renderer, self, artists, self.suppressComposite)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/axes/_base.py\", line 2437, in draw\r\n mimage._draw_list_compositing_images(renderer, self, artists)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 566, in draw\r\n renderer, renderer.get_image_magnification())\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 793, in make_image\r\n unsampled=unsampled)\r\n File \"/usr/local/lib/python3.5/dist-packages/matplotlib/image.py\", line 430, in _make_image\r\n if A.mask.shape == A.shape:\r\nAttributeError: 'numpy.ndarray' object has no attribute 'mask'\r\n```\r\n","author":{"url":"https://github.com/NewThinker-Jeffrey","@type":"Person","name":"NewThinker-Jeffrey"},"datePublished":"2018-02-27T03:07:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":16},"url":"https://github.com/10616/matplotlib/issues/10616"}
| 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:cabd9104-1ba1-ca48-42aa-c9096559124b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DCFE:274DA4:76B03F:A13A79:6A537515 |
| html-safe-nonce | a28d6c55acbd4697d8cb2e784724cb576131811287ad4cd5eeec41a84af97f71 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQ0ZFOjI3NERBNDo3NkIwM0Y6QTEzQTc5OjZBNTM3NTE1IiwidmlzaXRvcl9pZCI6IjMxNTMyNzQyODA3OTc3NjI4MzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b1b42019f83b0c8a8a15305101e9c37e04ec854ee94fd7d006f2c46ad361bc93 |
| hovercard-subject-tag | issue:300477898 |
| 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/10616/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c4dc8b1541a574dbb87ff444bddbed667bfd023b0ede5c53a81d99370e6fd376/matplotlib/matplotlib/issues/10616 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c4dc8b1541a574dbb87ff444bddbed667bfd023b0ede5c53a81d99370e6fd376/matplotlib/matplotlib/issues/10616 |
| og:image:alt | Hi I was using python3.5.2, numpy 1.14.1, and matplotlib 2.1.2 and encountered a problem when I attempted to show a picture with pyplot. It always gave errors saying 'numpy.ndarray object has no at... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NewThinker-Jeffrey |
| 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