Title: Issue · GitHub
Open Graph Title: Issue · matplotlib/matplotlib
X Title: Issue · matplotlib/matplotlib
Description: matplotlib: plotting with Python. Contribute to matplotlib/matplotlib development by creating an account on GitHub.
Open Graph Description: matplotlib: plotting with Python. Contribute to matplotlib/matplotlib development by creating an account on GitHub.
X Description: matplotlib: plotting with Python. Contribute to matplotlib/matplotlib development by creating an account on GitHub.
Opengraph URL: https://github.com/matplotlib/matplotlib
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BUG: plot_surface ignores lightsource when cmap/facecolors are not specified","articleBody":"Three different, undocumented, cases that I think should be the same:\r\n\r\n1. `plot_surface(..., shade=True, lightsource=..., cmap=..., facecolors=\"garbage\")` - uses `LightSource.shade`, which does some messy and unnecessary trig in `LightSource.hillshade`, using the orientation of the lightsource.\r\n\r\n2. `plot_surface(..., shade=True, lightsource=..., cmap=...)` - uses `_shade_colors`, which does a more sensible vector-based approach, but hard-codes a `[-1, -1, 0.5]` normal vector, rather than respecting the lightsource direction.\r\n\r\n3. `plot_surface(..., shade=True, lightsource=..., facecolors=\"garbage\")` - as above\r\n\r\nRegarding (2), I think that there is a typo in `axes3d.py`, and this change should be made:\r\n\r\n```diff\r\n # Shade the data\r\n- if shade and cmap is not None and fcolors is not None:\r\n+ if shade and cmap is not None and fcolors is None:\r\n fcolors = self._shade_colors_lightsource(Z, cmap, lightsource)\r\n```\r\nIt seems dumb to only calculate face colors if the user already asked for different ones.\r\n\r\nRegarding (3) - I think it would be useful to unify the shading into a normal-vector based approach, which I might try in a later patch\r\n\r\n\r\n","author":{"url":"https://github.com/eric-wieser","@type":"Person","name":"eric-wieser"},"datePublished":"2017-07-14T19:07:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/8877/matplotlib/issues/8877"}
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:fea81978-386c-a54a-c7e7-3dad67eaaa8c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B07A:1ECA58:C96C9D:10C1E3D:6A52C444 |
| html-safe-nonce | 77df569e378b61abfbea8a62ff73b1dd3a2ce48a34c1a2051bb7803bcfa518ed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDdBOjFFQ0E1ODpDOTZDOUQ6MTBDMUUzRDo2QTUyQzQ0NCIsInZpc2l0b3JfaWQiOiI1NTA0MDM3NzczMTM5NjkwNTY0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7e3130cba9f41b03494b5a6fd59212d4770b50cc64071dc9b4eb21bceb21b6a5 |
| hovercard-subject-tag | repository:1385122 |
| 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/matplotlib/matplotlib/issues/8877 |
| twitter:image | https://opengraph.githubassets.com/b96abeb564ab104ac4f960d0faab4d0a800e6204dc8b68914b054bf13c57a96e/matplotlib/matplotlib |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b96abeb564ab104ac4f960d0faab4d0a800e6204dc8b68914b054bf13c57a96e/matplotlib/matplotlib |
| og:image:alt | matplotlib: plotting with Python. Contribute to matplotlib/matplotlib development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-cache |
| 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