Title: text is not clipped by clip_path · Issue #8270 · matplotlib/matplotlib · GitHub
Open Graph Title: text is not clipped by clip_path · Issue #8270 · matplotlib/matplotlib
X Title: text is not clipped by clip_path · Issue #8270 · matplotlib/matplotlib
Description: Bug report Bug summary I expect that a matplotlib.text.Text object should disappear when clipped by setting clip_path=some_path. In practice, the text is still here. Code for reproduction import numpy as np import matplotlib as mpl from ...
Open Graph Description: Bug report Bug summary I expect that a matplotlib.text.Text object should disappear when clipped by setting clip_path=some_path. In practice, the text is still here. Code for reproduction import nu...
X Description: Bug report Bug summary I expect that a matplotlib.text.Text object should disappear when clipped by setting clip_path=some_path. In practice, the text is still here. Code for reproduction import nu...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/8270
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"text is not clipped by clip_path","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nI expect that a matplotlib.text.Text object should disappear when clipped by setting `clip_path=some_path`. In practice, the text is still here.\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib as mpl\r\nfrom matplotlib import pyplot as plt\r\n\r\nplt.figure(figsize=(8,8))\r\nax = plt.gca()\r\n\r\npoly = mpl.patches.Polygon([[1,0], [0,1], [-1,0], [0,-1]], \r\n facecolor=\"#ddffdd\", edgecolor=\"#00ff00\", linewidth=2, alpha=0.5)\r\n\r\nax.add_patch(poly)\r\n\r\n# should not be displayed ...\r\ntxt_outside = mpl.text.Text(0.75,0.75,\"outside :(\", clip_on=True, clip_path=poly)\r\nax.add_artist(txt_outside)\r\n\r\n# should be (and is) displayed\r\ntxt_inside = mpl.text.Text(0.,0.,\"inside :)\", clip_on=True, clip_path=poly)\r\nax.add_artist(txt_inside)\r\n\r\n# works perfectly\r\nscatter = plt.scatter(*np.transpose([[0.1,0.1],[0.7,0.7]]), zorder=5, clip_path=poly)\r\n\r\nax.set_xlim(-1,1)\r\nax.set_ylim(-1,1)\r\nplt.show()\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\r\n\r\n**Expected outcome**\r\n\r\nI would expect the text `outside :(` not to appear on the image.\r\n\r\n**Matplotlib version**\r\n\r\nThis happens with matplotlib 2.0.0 with python 3.6.0 (installed with anaconda on linux). It also happens with matplotlib 1.5.3 with python 3.5.2 (same setup).","author":{"url":"https://github.com/fruchart","@type":"Person","name":"fruchart"},"datePublished":"2017-03-11T17:04:21Z","url":"https://github.com/matplotlib/matplotlib/issues/8270"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:ba0d7d2e-42a3-8beb-8e84-e896c31f8d7f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B3F8:261BEA:11826E3:176B7CA:6B065C9E |
| html-safe-nonce | 2f0f45e198a55f4c29238603ecbf8e223f743fd1538bf5631188847ce4398c65 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0Y4OjI2MUJFQToxMTgyNkUzOjE3NkI3Q0E6NkIwNjVDOUUiLCJ2aXNpdG9yX2lkIjoiODY4NDcyNjgwNjk0MDkwMDUxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 43600a48fd721373570f6cd8c7ef3f769822aa57b81222aa996e60a3e1a817de |
| hovercard-subject-tag | issue:213541855 |
| 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/8270/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e440c632c078d0848051597451406abf21746a773f2d876a60bd1d71fd54ae07/matplotlib/matplotlib/issues/8270 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e440c632c078d0848051597451406abf21746a773f2d876a60bd1d71fd54ae07/matplotlib/matplotlib/issues/8270 |
| og:image:alt | Bug report Bug summary I expect that a matplotlib.text.Text object should disappear when clipped by setting clip_path=some_path. In practice, the text is still here. Code for reproduction import nu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fruchart |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6324e6ac990fb6befbec840cc0e102a1071c339bfe8f9826bb12de2e3ba1d297 |
| 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 | 7f0aa75f4141d440c6110dc31af7ea7797abb6c4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width