0
votes

So I am creating 1111 different plotly HEATMAPS from the same sort of data, however each of these plots has a slightly different colorscale range. This means that a "red" on one plot may not be the same "red" on another plot.

For the sake of reproducibility lets use the volcano dataset as an example.

I have found a way to force the scale on a plotly SURFACE plot using the following code:

p <- plot_ly(z = kdetest$z, type = "surface", colors = c("blue4", "blue", "green", 
             "yellow", "orange", "red", "red", "red", "red", "red"), 
             cauto = F, cmin = 0, cmax = 250)

This forces the colorscale between values 0 and 250 for a surface plot. I would expect that there should be a similar way to do this for heatmaps as they are just flat surface plots, however the heatmap type doesn't have variables cauto, cmin or cmax.

Does anyone know of a way to do this for heatmaps?

1

1 Answers

0
votes

The equivalent variables on heatmaps are zauto, zmin, zmax. So the following code should work:

p <- plot_ly(z = volcano, type = "heatmap", colors = c("blue4", "blue", "green", 
             "yellow", "orange", "red", "red", "red", "red", "red"), 
             zauto = F, cmin = 0, cmax = 250)