I am trying to arrange two pie charts in a single row using the subplot
function from the plotly package but the resultant plot is not what I expect. I was able to
library(plotly)
ds_r <- data.frame(labels1 = c("Baseline", "DTC", "Detailing", "Flex"),
values1 = c(63.5, 8.5, 20.6, 7.4))
ds_l <- data.frame(labels2 = c("Baseline"),
values2 = c(100))
df <- cbind(ds_r, ds_l)
plot_ly(df, labels = labels1, values = values1, type = "pie",
domain = list(x = c(0, 0.4)), showlegend = F) %>%
add_trace(labels = labels2, values = values2, type = "pie",
domain = list(x = c(0.6, 1)), showlegend = F)
I would add the picture, but plotlies are generally large files.