Title: Patch3DCollection doesn't update color after calling set_color · Issue #3370 · matplotlib/matplotlib · GitHub
Open Graph Title: Patch3DCollection doesn't update color after calling set_color · Issue #3370 · matplotlib/matplotlib
X Title: Patch3DCollection doesn't update color after calling set_color · Issue #3370 · matplotlib/matplotlib
Description: I've run into an issue in 1.3.1 and the latest nightly build of the 1.4.x release candidate where calling set_color on a Patch3DCollection object doesn't seem to work. I only see the issue when using a 3D plot. This bug was first reporte...
Open Graph Description: I've run into an issue in 1.3.1 and the latest nightly build of the 1.4.x release candidate where calling set_color on a Patch3DCollection object doesn't seem to work. I only see the issue when usi...
X Description: I've run into an issue in 1.3.1 and the latest nightly build of the 1.4.x release candidate where calling set_color on a Patch3DCollection object doesn't seem to work. I only see the issue ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/3370
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Patch3DCollection doesn't update color after calling set_color","articleBody":"I've run into an issue in 1.3.1 and the latest nightly build of the 1.4.x release candidate where calling `set_color` on a Patch3DCollection object doesn't seem to work. I only see the issue when using a 3D plot.\n\nThis bug was first reported [here](https://github.com/matplotlib/matplotlib/issues/3362), but it seems to be unrelated.\n\nBelow is a snippet similar to what I've been trying. You can comment the lines at the bottom to alternate which version (2d or 3d) you're testing. The same mechanism works for a 2d scatter plot, but not for a 3d one.\n\nThe goal is to add a new point on each animation. Then, change all older points to a different color. It's not optimal and will constantly change the color of old points even if they've already been changed. However, it clearly demonstrates that the call to set_color doesn't have any effect even though it's a somewhat silly example.\n\n``` python\nfrom mpl_toolkits.mplot3d import Axes3D\nimport matplotlib.animation as animation\nimport matplotlib.pylab as plt\n\nimport numpy as np\n\nNUM_POINTS = 10\nvalues = []\n\nfor ii in xrange(NUM_POINTS):\n values.append(np.random.random_integers(0, 500, 3))\n\npoints = []\n\nn = 0\n\n\ndef two_dim_example():\n def animate(i):\n \"\"\"\n Goal is to slowly add new points and have the most current point in red\n while all other points are gray\n \"\"\"\n\n global n\n\n # No more animation needed\n if n \u003e= NUM_POINTS:\n return\n\n # Change color of all old points\n for point in points:\n point.set_color('gray')\n\n x, y, z = values[n]\n\n point = ax2D.scatter(x, y, s=75, c='red', marker ='o')\n points.append(point)\n\n n += 1\n\n ax2D = fig1.add_subplot(111)\n ani = animation.FuncAnimation(fig1, animate, interval=500)\n plt.show()\n\n\ndef three_dim_example():\n def animate(i):\n \"\"\"\n Goal is to slowly add new points and have the most current point in red\n while all other points are gray\n \"\"\"\n\n global n\n\n # No more animation needed\n if n \u003e= NUM_POINTS:\n return\n\n # Change color of all old points\n for point in points:\n point.set_color('gray')\n\n x, y, z = values[n]\n\n point = ax3D.scatter(x, y, z, s=50, c='red', marker ='o')\n points.append(point)\n\n n += 1\n\n ax3D = fig2.add_subplot(111, projection='3d')\n ani = animation.FuncAnimation(fig2, animate, interval=500)\n plt.show()\n\n\n# Uncomment to see that 2d works\n#fig1 = plt.figure()\n#two_dim_example()\n\nfig2 = plt.figure()\nthree_dim_example()\n```\n","author":{"url":"https://github.com/durden","@type":"Person","name":"durden"},"datePublished":"2014-08-15T13:45:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/3370/matplotlib/issues/3370"}
| 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:c5aab964-8223-5303-85c8-8504446df10b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80B0:2A736A:13ADEB9:1A0AA38:6A5342B3 |
| html-safe-nonce | a4cafceff1bf396551667a317c2bca1ecaa8a6a7b2b0c5014a28523415b9bbc7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEIwOjJBNzM2QToxM0FERUI5OjFBMEFBMzg6NkE1MzQyQjMiLCJ2aXNpdG9yX2lkIjoiNjM3OTMxNzk4ODg0NDMyMzUwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5865aa391e6a39ef4a6f93cb46b9feaf70e7ad879e79c7c753065a297c8aa87f |
| hovercard-subject-tag | issue:40348811 |
| 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/3370/issue_layout |
| twitter:image | https://opengraph.githubassets.com/181d0dcc54d3dc877531815cd84f3e3b7ea566920b5429b02bb017aa95d1cb4b/matplotlib/matplotlib/issues/3370 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/181d0dcc54d3dc877531815cd84f3e3b7ea566920b5429b02bb017aa95d1cb4b/matplotlib/matplotlib/issues/3370 |
| og:image:alt | I've run into an issue in 1.3.1 and the latest nightly build of the 1.4.x release candidate where calling set_color on a Patch3DCollection object doesn't seem to work. I only see the issue when usi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | durden |
| 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