I am using plotly through the R API and Shiny.
I have a surface plot with z values between 0 and 1.5.
I would like to fix the color-value mapping for my plot so that the colors scale represents z values from 0 to 1.5. So in this case the top and bottom number labels on the color bar would be 0 and 1.5 respectively and any data in the plot would map to the same color regardless of the range of the data. Right now the color bar is relative meaning there is a fixed range of colors and the min and max z values map to each end of the color bar. This does not make the comparison of surface charts easy. Here is the basic code I am using to generate it.
p <- plot_ly(x = xVal,y = Yval,z = Zval, type = "surface")
I havenβt been able to do this even in the plotly web GUI environment.
Thanks.
When I tried this I initially thought my problem was solved. Unfortunately this only fixed the labeling of the color bar. It did not fix the color-value mapping. So if my data is between 0 and 0.5 the color of the highest data will still match the top of the color bar even though the top of the color bar is labeled 1.5. Is there is was to fix this?
Thanks for the example. Weβve recently addressed this issue but the update is not yet reflected in our CRAN release. For now, you could use our latest development version: