Title: zorder of Artists not being respected when blitting with FuncAnimation · Issue #11369 · matplotlib/matplotlib · GitHub
Open Graph Title: zorder of Artists not being respected when blitting with FuncAnimation · Issue #11369 · matplotlib/matplotlib
X Title: zorder of Artists not being respected when blitting with FuncAnimation · Issue #11369 · matplotlib/matplotlib
Description: Bugreport The zorder of artists is not being respected, when using blitting while creating an animation with FuncAnimation. The order in which the user-function returning artists that have to be adapted implicity set the order in which t...
Open Graph Description: Bugreport The zorder of artists is not being respected, when using blitting while creating an animation with FuncAnimation. The order in which the user-function returning artists that have to be ad...
X Description: Bugreport The zorder of artists is not being respected, when using blitting while creating an animation with FuncAnimation. The order in which the user-function returning artists that have to be ad...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/11369
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"zorder of Artists not being respected when blitting with FuncAnimation","articleBody":"**Bugreport**\r\nThe zorder of artists is not being respected, when using blitting while creating an animation with [FuncAnimation](https://github.com/matplotlib/matplotlib/blob/6ec80eac66c4828f28540f76734cae811787d626/lib/matplotlib/animation.py#L1543). The order in which the user-function returning artists that have to be adapted implicity set the order in which they are updated and thus artists may actually be covered by other artists with lower zorder (see example below).\r\n\r\n**Code for reproduction**\r\n```python\r\nimport numpy as np\r\nfrom matplotlib import pyplot as plt\r\nfrom matplotlib import animation\r\n\r\nfig = plt.figure()\r\nax = plt.axes(xlim=(0, 2), ylim=(-2, 2))\r\nred_sine, = ax.plot([], [], lw=5, color=\"r\", zorder=2)\r\ngreen_sine, = ax.plot([], [], lw=2, color=\"g\", zorder=3)\r\n\r\ndef init():\r\n green_sine.set_data([], [])\r\n red_sine.set_data([], [])\r\n return green_sine, red_sine,\r\n\r\ndef ani(time):\r\n x = np.linspace(0, 2, 1000)\r\n y = np.sin(2 * np.pi * (x - 0.01 * time))\r\n green_sine.set_data(x, y)\r\n red_sine.set_data(x, y)\r\n return green_sine, red_sine,\r\n\r\nanim = animation.FuncAnimation(fig, ani, init_func=init, frames=100, interval=2, blit=True)\r\nplt.show()\r\n```\r\n\r\nNote: When adding pictures i noticed, that using the GUI-Buttons for saving yield expected results. On screen however results are as shown below. I briefly switched backends to 'TkAgg' without improvement.\r\n\r\n**Actual outcome**\r\n\r\n\r\n**Expected outcome**\r\n\r\n\r\n**Matplotlib version**\r\n * Operating system: Windows 7\r\n * Matplotlib version: 2.2.2\r\n * Matplotlib backend: Qt5Agg\r\n * Python version: 3.5.5\r\n(virtual env via conda)\r\n\r\n","author":{"url":"https://github.com/jdollichon","@type":"Person","name":"jdollichon"},"datePublished":"2018-06-02T17:10:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/11369/matplotlib/issues/11369"}
| 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:1dc1f9a5-f85e-4b81-ab4e-c0478f3192a0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB4E:35F6F0:AEEF0:E8BAA:6A515BE1 |
| html-safe-nonce | 67745fe96a137140ba3ac778126f44a5b11278b3224c572849520f5710a7ed13 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjRFOjM1RjZGMDpBRUVGMDpFOEJBQTo2QTUxNUJFMSIsInZpc2l0b3JfaWQiOiIxMjM1MDUxNTIwMjkyMTE3NDczIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 53bff789901b73333e865132f96213fbd213417c354a536da0d1f4b774afc408 |
| hovercard-subject-tag | issue:328760466 |
| 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/11369/issue_layout |
| twitter:image | https://opengraph.githubassets.com/58e84d9406d02384cad78e2e791762ce7a94f7b74a46804931fb41bb783d204e/matplotlib/matplotlib/issues/11369 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/58e84d9406d02384cad78e2e791762ce7a94f7b74a46804931fb41bb783d204e/matplotlib/matplotlib/issues/11369 |
| og:image:alt | Bugreport The zorder of artists is not being respected, when using blitting while creating an animation with FuncAnimation. The order in which the user-function returning artists that have to be ad... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jdollichon |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6f17634ed2af1d116850bcea6c63a70a4d72970f33ade1dd3eef3764b7e16994 |
| 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 | 2d32229a0a79708ee9a4f132f630b36d58b4495a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width