Title: The face color of a patch affects its hatches in PDF viewed with Acrobat Reader · Issue #9894 · matplotlib/matplotlib · GitHub
Open Graph Title: The face color of a patch affects its hatches in PDF viewed with Acrobat Reader · Issue #9894 · matplotlib/matplotlib
X Title: The face color of a patch affects its hatches in PDF viewed with Acrobat Reader · Issue #9894 · matplotlib/matplotlib
Description: Bug summary Originally reported in the thread of #8431. When using hatches with a patch and exporting to a PDF, the patch face color seems to also be applied to (or to overlay) the hatches when viewing the file with Acrobat Reader, which...
Open Graph Description: Bug summary Originally reported in the thread of #8431. When using hatches with a patch and exporting to a PDF, the patch face color seems to also be applied to (or to overlay) the hatches when vie...
X Description: Bug summary Originally reported in the thread of #8431. When using hatches with a patch and exporting to a PDF, the patch face color seems to also be applied to (or to overlay) the hatches when vie...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/9894
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The face color of a patch affects its hatches in PDF viewed with Acrobat Reader","articleBody":"**Bug summary**\r\n\r\nOriginally reported in the thread of #8431.\r\n\r\nWhen using hatches with a patch and exporting to a PDF, the patch face color seems to also be applied to (or to overlay) the hatches when viewing the file with Acrobat Reader, which is neither the case in the Matplotlib interactive window nor when opening the same PDF with Evince. Not sure if it is the alpha value of the face color that is wrongly interpreted, or simply the z-order between the face color and the hatches.\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.patches as mpatches\r\nimport matplotlib as mpl\r\n\r\nrect = mpatches.Rectangle((0.25, 0.25), 0.5, 0.5, hatch=\"x\",\r\n edgecolor=\"darkred\", facecolor=[0.5, 0.5, 0.5, 0.1])\r\n\r\nfig, ax = plt.subplots()\r\nax.add_patch(rect)\r\nfig.savefig(\"with_{0}.pdf\".format(mpl.__version__))\r\n```\r\n\r\n**Actual outcome**\r\n\r\nAn exemple of the PDF produced by the snippet above:\r\n[with_2.1.0.post933+gd046efbc2.pdf](https://github.com/matplotlib/matplotlib/files/1519769/with_2.1.0.post933.gd046efbc2.pdf)\r\n\r\nA screenshot comparing this file opened with Evince (on the left) and with Acrobat Reader (on the right):\r\n\r\n\r\nI get a similar output/behavior with Matplotlib 2.0.0. However, with Matplotlib 1.5.3, something is going wrong and I am thrown the following traceback below, so I do not know if it is really a kind of regression.\r\n\r\n```\r\n# Traceback when tryin to run the MWE with tags/v1.5.3\r\n\r\n---------------------------------------------------------------------------\r\nImportError Traceback (most recent call last)\r\n~/Playground/Matplotlib/transparent_hatches/mwe_issue.py in \u003cmodule\u003e()\r\n 10 fig, ax = plt.subplots()\r\n 11 ax.add_patch(rect)\r\n---\u003e 12 fig.savefig(\"with_{0}.pdf\".format(mpl.__version__))\r\n\r\n~/FOSS/matplotlib/lib/matplotlib/figure.py in savefig(self, *args, **kwargs)\r\n 1561 self.set_frameon(frameon)\r\n 1562 \r\n-\u003e 1563 self.canvas.print_figure(*args, **kwargs)\r\n 1564 \r\n 1565 if frameon:\r\n\r\n~/FOSS/matplotlib/lib/matplotlib/backends/backend_qt5agg.py in print_figure(self, *args, **kwargs)\r\n 201 \r\n 202 def print_figure(self, *args, **kwargs):\r\n--\u003e 203 FigureCanvasAgg.print_figure(self, *args, **kwargs)\r\n 204 self.draw()\r\n 205 \r\n\r\n~/FOSS/matplotlib/lib/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)\r\n 2137 \r\n 2138 # get canvas object and print method for format\r\n-\u003e 2139 canvas = self._get_output_canvas(format)\r\n 2140 print_method = getattr(canvas, 'print_%s' % format)\r\n 2141 \r\n\r\n~/FOSS/matplotlib/lib/matplotlib/backend_bases.py in _get_output_canvas(self, format)\r\n 2069 \r\n 2070 # check if there is a default canvas for the requested format\r\n-\u003e 2071 canvas_class = get_registered_canvas_class(format)\r\n 2072 if canvas_class:\r\n 2073 return self.switch_backends(canvas_class)\r\n\r\n~/FOSS/matplotlib/lib/matplotlib/backend_bases.py in get_registered_canvas_class(format)\r\n 135 backend_class = _default_backends[format]\r\n 136 if cbook.is_string_like(backend_class):\r\n--\u003e 137 backend_class = import_module(backend_class).FigureCanvas\r\n 138 _default_backends[format] = backend_class\r\n 139 return backend_class\r\n\r\n~/anaconda3/envs/matplotlib_dev/lib/python3.6/importlib/__init__.py in import_module(name, package)\r\n 124 break\r\n 125 level += 1\r\n--\u003e 126 return _bootstrap._gcd_import(name[level:], package, level)\r\n 127 \r\n 128 \r\n\r\n~/anaconda3/envs/matplotlib_dev/lib/python3.6/importlib/_bootstrap.py in _gcd_import(name, package, level)\r\n\r\n~/anaconda3/envs/matplotlib_dev/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)\r\n\r\n~/anaconda3/envs/matplotlib_dev/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)\r\n\r\n~/anaconda3/envs/matplotlib_dev/lib/python3.6/importlib/_bootstrap.py in _load_unlocked(spec)\r\n\r\n~/anaconda3/envs/matplotlib_dev/lib/python3.6/importlib/_bootstrap_external.py in exec_module(self, module)\r\n\r\n~/anaconda3/envs/matplotlib_dev/lib/python3.6/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)\r\n\r\n~/FOSS/matplotlib/lib/matplotlib/backends/backend_pdf.py in \u003cmodule\u003e()\r\n 32 from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\\\r\n 33 FigureManagerBase, FigureCanvasBase\r\n---\u003e 34 from matplotlib.backends.backend_mixed import MixedModeRenderer\r\n 35 from matplotlib.cbook import Bunch, is_string_like, \\\r\n 36 get_realpath_and_stat, is_writable_file_like, maxdict\r\n\r\n~/FOSS/matplotlib/lib/matplotlib/backends/backend_mixed.py in \u003cmodule\u003e()\r\n 4 from matplotlib.externals import six\r\n 5 \r\n----\u003e 6 from matplotlib._image import frombuffer\r\n 7 from matplotlib.backends.backend_agg import RendererAgg\r\n 8 from matplotlib.tight_bbox import process_figure_for_rasterizing\r\n\r\nImportError: cannot import name 'frombuffer'\r\n```\r\n\r\n**Expected outcome**\r\n\r\nThe same behavior with both PDF viewers, i.e. the hatches not being affected by the the face color of the patch. \r\n\r\n**Matplotlib version**\r\n\r\n * Operating system: Linux (Fedora 27)\r\n * Matplotlib version: 1.5.3, 2.0.0 and master\r\n * Matplotlib backend (`print(matplotlib.get_backend())`):\r\n * Python version: 3.6, from conda\r\n * Jupyter version (if applicable):\r\n * Other softwares: Acrobat Reader 9.5.5\r\n","author":{"url":"https://github.com/afvincent","@type":"Person","name":"afvincent"},"datePublished":"2017-11-30T23:09:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/9894/matplotlib/issues/9894"}
| 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:2ee131ae-54f8-5af8-ca8e-d4eb1d7bdb5e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9BA2:240794:2EB45D8:3F0F51F:6A53C1F1 |
| html-safe-nonce | 3f04cf7f024012063e578e1cb6d6288c248933ebbb0145353ef3671ecdee050e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QkEyOjI0MDc5NDoyRUI0NUQ4OjNGMEY1MUY6NkE1M0MxRjEiLCJ2aXNpdG9yX2lkIjoiNTY1NzM4NTE5MDk4Njg1ODk5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b3f63118f91b511cc0ffb5d6a31c2bc5745d4270ef29d2db92bb17a9b09191a7 |
| hovercard-subject-tag | issue:278302205 |
| 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/9894/issue_layout |
| twitter:image | https://opengraph.githubassets.com/41ced58058bf068ed5c6a913d9a885b0d8293d10ed1f05995dbb49bf3a265da7/matplotlib/matplotlib/issues/9894 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/41ced58058bf068ed5c6a913d9a885b0d8293d10ed1f05995dbb49bf3a265da7/matplotlib/matplotlib/issues/9894 |
| og:image:alt | Bug summary Originally reported in the thread of #8431. When using hatches with a patch and exporting to a PDF, the patch face color seems to also be applied to (or to overlay) the hatches when vie... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | afvincent |
| 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