Title: multiple imshow in figure are rendered as single image in svg, causing problems when clipping images · Issue #7151 · matplotlib/matplotlib · GitHub
Open Graph Title: multiple imshow in figure are rendered as single image in svg, causing problems when clipping images · Issue #7151 · matplotlib/matplotlib
X Title: multiple imshow in figure are rendered as single image in svg, causing problems when clipping images · Issue #7151 · matplotlib/matplotlib
Description: I am on matplotlib 1.5.1 (but i suppose this is not related with this specific version) This is probably a bug/limit of the svg export engine (maybe known?) when multiple calls to imshow are made in the same figure and then saved in svg ...
Open Graph Description: I am on matplotlib 1.5.1 (but i suppose this is not related with this specific version) This is probably a bug/limit of the svg export engine (maybe known?) when multiple calls to imshow are made i...
X Description: I am on matplotlib 1.5.1 (but i suppose this is not related with this specific version) This is probably a bug/limit of the svg export engine (maybe known?) when multiple calls to imshow are made i...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/7151
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"multiple imshow in figure are rendered as single image in svg, causing problems when clipping images","articleBody":"I am on matplotlib 1.5.1 (but i suppose this is not related with this specific version)\nThis is probably a bug/limit of the svg export engine (maybe known?)\n\nwhen multiple calls to imshow are made in the same figure and then saved in svg ALL the calls are joined into a single raster instead of having multiple (e.g. grouped) images in the svg file.\n\nThis make fail a simple test case like this. We call two times imshow to position two images in the figure, then we clip the two images with two different shapes. The problem is that in the svg the two imshow calls are joined in an unique raster, thus the clips are simply not created at all in the svg. Exporting each imshow() raster as a separated image in the svg, each with their clips, would probably solve the problem.\nIs it possible or is a known limit?\n\n if saved as png:\n\n\nand as svg:\n\n\nCode for generating these pictures (for a notebook):\n\n``` python\n%pylab inline\n\nimport matplotlib\n\npylab.rcParams['figure.figsize'] = (8, 8)\n\na = np.random.randn(100,100)\nb = np.random.randn(100,100)\n\nim1 = imshow(a, extent = [0,1,0,1])\nim2 = imshow(b, extent = [1.2,2.2,1.2,2.2])\nxlim(0,2.2)\nylim(0,2.2)\n\nfrom matplotlib.path import Path\nverts1 = np.array([[0.5,0.5],[1,0.5],[1,1], [0,0.5], [0.5,0.5]])\npath1 = Path(verts1)\npath2 = Path(verts1 + np.array([1.1, 1.2]))\n\n\nimport matplotlib.patches as patches\npatch1 = patches.PathPatch(path1, facecolor=None, alpha=0)\ngca().add_patch(patch1)\n\npatch2 = patches.PathPatch(path2, facecolor=None, alpha=0)\ngca().add_patch(patch2)\n\nim1.set_clip_path(patch1)\nim2.set_clip_path(patch2)\n\nsavefig(\"test.png\")\nsavefig(\"test.svg\")\n```\n\nmany thanks for the wonderful work :+1: \n\nLuca\n","author":{"url":"https://github.com/luca-penasa","@type":"Person","name":"luca-penasa"},"datePublished":"2016-09-21T09:39:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/7151/matplotlib/issues/7151"}
| 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:04e26e54-ec27-fe58-9328-a563ed3bb370 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C22E:2F0FE8:1C1426E:25AADEB:6A536AC7 |
| html-safe-nonce | ba5efd79f91526d01bbb223f34bc31642d0c452ead9398de1463b2a503c58335 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjJFOjJGMEZFODoxQzE0MjZFOjI1QUFERUI6NkE1MzZBQzciLCJ2aXNpdG9yX2lkIjoiNjc3NTg4MzcwMDk0NzM0ODE2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 58219f039f14030473ad8e2c9faeade66ea1934539ebe874e4e411550fbbc29b |
| hovercard-subject-tag | issue:178295955 |
| 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/7151/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3a008edc63f72fcc7c9c9a334c196931afddcd08b8357f65b49899d6eb410b29/matplotlib/matplotlib/issues/7151 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3a008edc63f72fcc7c9c9a334c196931afddcd08b8357f65b49899d6eb410b29/matplotlib/matplotlib/issues/7151 |
| og:image:alt | I am on matplotlib 1.5.1 (but i suppose this is not related with this specific version) This is probably a bug/limit of the svg export engine (maybe known?) when multiple calls to imshow are made i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | luca-penasa |
| 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