-
Notifications
You must be signed in to change notification settings - Fork 633
ColorScale Will Not Change If Specifying with colorscale = c('hexcode1', 'hexcode2') #1846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @cpsievert, Another reprex: plotly::plot_ly(mtcars, x = ~ wt, y = ~ hp) |>
plotly::add_markers(color = ~ mpg,
marker = list(colorscale = c("black", "red"))) Formatted differently, it appears to apply the color gradient to the markers, but the colorbar doesn't update: plotly::plot_ly(mtcars, x = ~ wt, y = ~ hp) |>
plotly::add_markers(color = ~ mpg,
marker = list(colorscale = list(c(0,1), c("black", "red")))) Using an array: plotly::plot_ly(mtcars, x = ~ wt, y = ~ hp) |>
plotly::add_markers(color = ~ mpg,
marker = list(colorscale = list(
c(0, 0.2, 0.4, 0.6, 0.8, 1),
c(
"#FFB7B2",
"#EA9C95",
"#D68279",
"#C2675C",
"#AE4D40",
"#9A3324"
)
)))
Are these issues in the plotly R library or in plotly js? |
I think the issue may be that Try this:
IMHO the real issue is the incorrect example at https://plotly.com/r/3d-scatter-plots/#3d-scatter-plot-with-color-scaling It should be:
|
Hi,
After following the guide here, https://plotly.com/r/3d-scatter-plots/, I found that, when specifying color scale with colorscale = c('hexcode1', 'hexcode2') will not have changes to the color scale, yet the default palette names such as 'Rainbow' will work. In this case, it would not be possible to self-define the 2 end points of the color scale. Please feel free to run the R codes below to see what I mean.
Just wondering if this is a bug or may be there needs some updates to the guide?
Thanks,
The text was updated successfully, but these errors were encountered: