Title: Cannot set colorscale in template for some trace types · Issue #3100 · plotly/plotly.js · GitHub
Open Graph Title: Cannot set colorscale in template for some trace types · Issue #3100 · plotly/plotly.js
X Title: Cannot set colorscale in template for some trace types · Issue #3100 · plotly/plotly.js
Description: In working on developing templates for plotly.py I've found that I'm not able to set the colorscale and colorbar properties in the template for some trace types. This works as I expect for the heatmap trace type. The defualt colorscale o...
Open Graph Description: In working on developing templates for plotly.py I've found that I'm not able to set the colorscale and colorbar properties in the template for some trace types. This works as I expect for the heat...
X Description: In working on developing templates for plotly.py I've found that I'm not able to set the colorscale and colorbar properties in the template for some trace types. This works as I expect for ...
Opengraph URL: https://github.com/plotly/plotly.js/issues/3100
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot set colorscale in template for some trace types","articleBody":"In working on developing templates for plotly.py I've found that I'm not able to set the colorscale and colorbar properties in the template for some trace types.\r\n\r\nThis works as I expect for the `heatmap` trace type. The defualt colorscale of Viridis and the colorbar tick properties are both applied.\r\nPen: https://codepen.io/jonmmease/pen/mzMeMW\r\n```javascript\r\nvar trace1 = {\r\n type: 'heatmap',\r\n z: [[1, 2, 3], [4, 5, 6]],\r\n};\r\n\r\nvar data = [ trace1 ];\r\n\r\nvar layout = {\r\n template: {\r\n data: {\r\n heatmap: [{\r\n colorscale: 'Viridis',\r\n colorbar: {\r\n ticks: 'inside',\r\n ticklen: 10,\r\n tickcolor: 'white'\r\n }\r\n }],\r\n }\r\n }\r\n};\r\n\r\nPlotly.newPlot('myDiv', data, layout);\r\n```\r\n\r\n\r\nBut it does not work for the `scatter.marker` colorscale and colorbar.\r\nPen: https://codepen.io/jonmmease/pen/LgjpQG\r\n```javascript\r\nvar trace1 = {\r\n type: 'scatter',\r\n y: [1, 2, 3],\r\n marker: {\r\n size: 20,\r\n color: [1, 2, 3],\r\n showscale: true\r\n },\r\n mode: 'markers'\r\n};\r\n\r\nvar data = [ trace1 ];\r\n\r\nvar layout = {\r\n template: {\r\n data: {\r\n scatter: [{\r\n marker: {\r\n symbol: 'square',\r\n colorscale: 'Viridis',\r\n colorbar: {\r\n ticks: 'inside',\r\n ticklen: 10,\r\n tickcolor: 'white'\r\n } \r\n }\r\n }],\r\n }\r\n }\r\n};\r\n\r\nPlotly.newPlot('myDiv', data, layout);\r\n```\r\n\r\nNote that `scatter.marker.symbol` is being picked up from the template, so I'm pretty sure the template specification is correct, but let me know if I'm missing something.\r\n\r\nI've noticed this same behavior for other colorscales and colorbars, and I can work through an exhaustive list later today if that's helpful. Thanks!\r\n","author":{"url":"https://github.com/jonmmease","@type":"Person","name":"jonmmease"},"datePublished":"2018-10-12T10:41:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/3100/plotly.js/issues/3100"}
| 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:612b8114-b1ef-1c96-3f0b-9a4797fd5ac3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A4BE:2747ED:594B36:772A1B:6A58280C |
| html-safe-nonce | fc2920b93132730552a30a936c584db440361ec5b5e9350084b6ac6803f5a674 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEJFOjI3NDdFRDo1OTRCMzY6NzcyQTFCOjZBNTgyODBDIiwidmlzaXRvcl9pZCI6IjE2Nzk2MzA0Mzk4NjkzMjczNzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c3c7594efa595010d8a74c583131cf743e4eeb8d4857faf456295a7c1f4f5795 |
| hovercard-subject-tag | issue:369497144 |
| 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.js/3100/issue_layout |
| twitter:image | https://opengraph.githubassets.com/499b6fb5390aae3a58e1a5430f45557a132eefdb7653d9a78c641ac62dddd99e/plotly/plotly.js/issues/3100 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/499b6fb5390aae3a58e1a5430f45557a132eefdb7653d9a78c641ac62dddd99e/plotly/plotly.js/issues/3100 |
| og:image:alt | In working on developing templates for plotly.py I've found that I'm not able to set the colorscale and colorbar properties in the template for some trace types. This works as I expect for the heat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jonmmease |
| hostname | github.com |
| expected-hostname | github.com |
| None | 49c8c15fabcbf356d607a90ca115c13b273e42ff8b74155de050fd229a9b0121 |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.js git https://github.com/plotly/plotly.js.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 45646037 |
| octolytics-dimension-repository_nwo | plotly/plotly.js |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 45646037 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.js |
| 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 | 3fb1f684e7a833eb1b2d01d39875a2b52cb4fe9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width