I was using plotly to render a 3D scatter plot in a shiny app with a color gradient. While the basic scatter plot itself is no problem I cannot seem to be able to change the colors of the color gradient, even for the example provided here: https://plotly.com/r/3d-scatter-plots/. (see code snippet).
I tried multiple color combinations with both standard colors and hexacode.
library(plotly)
fig <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec,
marker = list(color = ~mpg, colorscale = c('#FFE1A1', '#683531'), showscale = TRUE))
fig <- fig %>% add_markers()
fig <- fig %>% layout(scene = list(xaxis = list(title = 'Weight'),
yaxis = list(title = 'Gross horsepower'),
zaxis = list(title = '1/4 mile time')),
annotations = list(
x = 1.13,
y = 1.05,
text = 'Miles/(US) gallon',
xref = 'paper',
yref = 'paper',
showarrow = FALSE
))
fig
Any help is greatly appreciated. Cheers