Title: [Doc]: add animation examples to show animated subplots · Issue #23909 · matplotlib/matplotlib · GitHub
Open Graph Title: [Doc]: add animation examples to show animated subplots · Issue #23909 · matplotlib/matplotlib
X Title: [Doc]: add animation examples to show animated subplots · Issue #23909 · matplotlib/matplotlib
Description: Documentation Link https://matplotlib.org/devdocs/gallery/animation/index.html Problem Figured it'd be useful to have at least one example in the docs to show that it's possible and encourage the use of the OO paradigm. There used to be ...
Open Graph Description: Documentation Link https://matplotlib.org/devdocs/gallery/animation/index.html Problem Figured it'd be useful to have at least one example in the docs to show that it's possible and encourage the u...
X Description: Documentation Link https://matplotlib.org/devdocs/gallery/animation/index.html Problem Figured it'd be useful to have at least one example in the docs to show that it's possible and encoura...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/23909
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Doc]: add animation examples to show animated subplots","articleBody":"### Documentation Link\r\n\r\nhttps://matplotlib.org/devdocs/gallery/animation/index.html\r\n\r\n### Problem\r\n\r\nFigured it'd be useful to have at least one example in the docs to show that it's possible and encourage the use of the OO paradigm. There used to be a [subplot example](https://matplotlib.org/2.1.2/gallery/animation/subplots.html), but \u003cstrike\u003ethat was back when it was overly complicated to do animated subplots.\u003c/strike\u003e it was removed in #10125\r\n\r\n### Suggested improvement\r\n\r\nAdd a new example showing how animation on subplots work. I originally thought of merging existing examples but they all feel overly complicated so I think this should be super simple, like 3 plots: sine/cosine/tangent and two lines each in the style of https://matplotlib.org/devdocs/gallery/animation/simple_anim.html#sphx-glr-gallery-animation-simple-anim-py\r\n\r\nI was thinking something like this, but if there's an easier or alternative, we should probably show that (too/instead of):\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.animation as animation\r\n\r\nfig, (ax1, ax2, ax3) = plt.subplots()\r\n\r\nx = np.arange(0, 2*np.pi, 0.01)\r\nline1, = ax1.plot(x, np.sin(x))\r\nline2, = ax2.plot(x, np.cos(x))\r\nline3, = ax3.plot(x, np.tan(x))\r\n\r\ndef animate(i):\r\n line1.set_ydata(np.sin(x + i / 50)) # update the data.\r\n line2.set_ydata(np.sin(x + i / 50)) \r\n line3.set_ydata(np.sin(x + i / 50)) \r\n return [line1, line2, line3]\r\n\r\n\r\nani = animation.FuncAnimation(\r\n fig, animate, interval=20, blit=True, save_count=50)\r\n\r\n```","author":{"url":"https://github.com/story645","@type":"Person","name":"story645"},"datePublished":"2022-09-16T14:14:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/23909/matplotlib/issues/23909"}
| 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:af46bea9-b90e-6f5e-23cf-9416914324b5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B684:BDE76:5258EDD:733BB3B:6A510335 |
| html-safe-nonce | 16f3b06341f395dc99e802c2e4253013cc3fa4bf7388077b3acc90c7e8c14ec1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjg0OkJERTc2OjUyNThFREQ6NzMzQkIzQjo2QTUxMDMzNSIsInZpc2l0b3JfaWQiOiIyMTMzNDY2NjYzMjM1OTQ1MjY5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 95d5aa3646b1fd633982783eb61ec075b45ae11c80050f21897d627f6a02223d |
| hovercard-subject-tag | issue:1376012404 |
| 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/23909/issue_layout |
| twitter:image | https://opengraph.githubassets.com/794e9c4d5c3b35e6cb9cfd26fbc987d33377159d17eb735b0a1937ab0d2013d5/matplotlib/matplotlib/issues/23909 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/794e9c4d5c3b35e6cb9cfd26fbc987d33377159d17eb735b0a1937ab0d2013d5/matplotlib/matplotlib/issues/23909 |
| og:image:alt | Documentation Link https://matplotlib.org/devdocs/gallery/animation/index.html Problem Figured it'd be useful to have at least one example in the docs to show that it's possible and encourage the u... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | story645 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 38906a4da4e3e9fd88dfeacee232f5932c0c5f7495de3b4efc53ddfac7173d12 |
| 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 | 90441ea9b98e7491aa6ebcd135fccce4e2396f48 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width