Similar to this topic but still I cannot solve the following issue.
I’ve got two layers of markers for which I’d like to use separate colour mappings. The problem is that the second
add_marker inherits the palette from the first one. Is there anything like
ggnewscale::new_scale_color() in native plotly? I’ve tried with
inherit=F, but to no avail.
require(plotly) df = data.frame(x = runif(10), y = runif(10), m = runif(10), b = round(runif(10))) plot_ly(data = df, x = ~x, y = ~y) %>% add_markers(color = ~m, colors = viridisLite::viridis(10), size = I(100)) %>% add_markers(color = ~factor(b), colors = c(`0` = "black", `1` = "red"))