Hi!
I would like to manually control the color order of two matched piecharts drawn with plotly but could not come to a satisfying solution so far.
Working example:
dt <- data.frame(
A = c(10, 1, 5, 3, 2),
B = c(0, 10, 0, 0, 10),
Index = c(1, 2, 3, 4, 5))
pieChart1 <- plotly::plot_ly(dt, values = ~A, type = ‘pie’)
pieChart2 <- plotly::plot_ly(dt, values = ~B, type = ‘pie’)
In this example, colors would be related to the Index value or the row number. For instance, row number 1 would be “blue” (and only displayed in graph 1), row number 2 would be “red” (and displayed in both graph 1/2), …
Could anyone provide a solution for this issue (preference for R or python if possible) ?
Thanks in advance!