Title: 3d Surface bug in Python? A custom colorscale defined with rgba values ignores the alpha specification · Issue #1859 · plotly/plotly.py · GitHub
Open Graph Title: 3d Surface bug in Python? A custom colorscale defined with rgba values ignores the alpha specification · Issue #1859 · plotly/plotly.py
X Title: 3d Surface bug in Python? A custom colorscale defined with rgba values ignores the alpha specification · Issue #1859 · plotly/plotly.py
Description: Hi There! I am trying to create a surface with surfacecolor and a custom colorscale to set a per point transparency. The global opacity is working well, however the per point opacity specified in a custom colorscale with the rga definiti...
Open Graph Description: Hi There! I am trying to create a surface with surfacecolor and a custom colorscale to set a per point transparency. The global opacity is working well, however the per point opacity specified in a...
X Description: Hi There! I am trying to create a surface with surfacecolor and a custom colorscale to set a per point transparency. The global opacity is working well, however the per point opacity specified in a...
Opengraph URL: https://github.com/plotly/plotly.py/issues/1859
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"3d Surface bug in Python? A custom colorscale defined with rgba values ignores the alpha specification","articleBody":"Hi There!\r\n\r\nI am trying to create a surface with surfacecolor and a custom colorscale to set a per point transparency.\r\n\r\nThe global opacity is working well, however the per point opacity specified in a custom colorscale with the rga definitions are ignored.\r\n\r\nThis is what I am doing:\r\n\r\n```\r\nfrom skimage.draw import circle\r\nimport plotly.graph_objects as go\r\nimport pandas as pd\r\nimport numpy as np\r\n%pylab inline\r\n\r\n# Read data from a csv\r\nz_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv')\r\n\r\n\r\n#make a custom surfacecolor to color just the middle of the surface\r\nsurfacecolor = np.zeros((25, 25), dtype=np.uint8)\r\nrr, cc = circle(12.5, 12.5, 5)\r\nsurfacecolor[rr, cc] = 1\r\nplt.matshow(surfacecolor)\r\n\r\n\r\n#simple colorscale from black to pure red\r\ncolorscale=[ \r\n [0, \"rgb(0, 0, 0)\"],\r\n [1.0, \"rgb(255, 0, 0)\"]]\r\n\r\n#Plotting a surface with the global opacity is working well!\r\nfig = go.Figure(data=[go.Surface(z=z_data.values,opacity=0.8, surfacecolor=surfacecolor,colorscale=colorscale)])\r\n\r\n\r\nfig.update_layout(title='Mt Bruno Elevation', autosize=False,\r\n width=500, height=500,\r\n margin=dict(l=65, r=50, b=65, t=90))\r\n\r\nfig.show()\r\n\r\n# Same as before but now we use rgba to set the transparency, black now should be full transparent\r\ncolorscale=[ \r\n [0, \"rgba(0, 0, 0,0)\"],\r\n [1.0, \"rgba(255, 0, 0,1)\"]]\r\n\r\n#per point opacity is broken :(\r\nfig = go.Figure(data=[go.Surface(z=z_data.values,\r\n surfacecolor=surfacecolor,\r\n colorscale=colorscale)])\r\n\r\nfig.update_layout(title='Mt Bruno Elevation', autosize=False,\r\n width=500, height=500,\r\n margin=dict(l=65, r=50, b=65, t=90))\r\n\r\nfig.show()\r\n\r\n#this is not working :(\r\n```\r\n\r\n\r\nI created a jupyter notebook so you can reproduce the error\r\n\r\n\r\n","author":{"url":"https://github.com/lucapinello","@type":"Person","name":"lucapinello"},"datePublished":"2019-11-02T16:45:00Z","url":"https://github.com/plotly/plotly.py/issues/1859"}
| 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:be56b498-f9a9-3c37-b262-7dc94716aa2f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C646:29AEE8:29F5B5D:37EC59E:6B01BC73 |
| html-safe-nonce | 59ee86d3ff753f214244e277230b3335e16b4c98cf7809f8257255eb27527175 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjQ2OjI5QUVFODoyOUY1QjVEOjM3RUM1OUU6NkIwMUJDNzMiLCJ2aXNpdG9yX2lkIjoiODc0NDM0NzA0MzI3MjcwMzA5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ec21b8392582810359b4d793a91706549c5eacaf398b0f31646b7f6c90ee6129 |
| hovercard-subject-tag | issue:516652273 |
| 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/plotly/plotly.py/1859/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d80786fcd356364da2f0ef781d7733f623a5b26e6cddcd7c9409c01079aec6a4/plotly/plotly.py/issues/1859 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d80786fcd356364da2f0ef781d7733f623a5b26e6cddcd7c9409c01079aec6a4/plotly/plotly.py/issues/1859 |
| og:image:alt | Hi There! I am trying to create a surface with surfacecolor and a custom colorscale to set a per point transparency. The global opacity is working well, however the per point opacity specified in a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lucapinello |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.py git https://github.com/plotly/plotly.py.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 14579099 |
| octolytics-dimension-repository_nwo | plotly/plotly.py |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14579099 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.py |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width