I need to make a pie chart with R plotly, but in stead of showing the percentages, I would like the raw counts overlaid on the pie sections (i.e. 300, 250, 110, 190).
The code below makes the pie chart, but with percentages.
WhatIHave <- c("Money" = 300,
"Dinosaurs" = 250,
"Aether" = 110,
"Discussions" = 190)
data <- data.frame("Category" = names(WhatIHave), WhatIHave)
p <- plot_ly(data, labels = ~Category, values = ~WhatIHave, type = 'pie') %>%
layout(title = 'Lovely Pie',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
p
I can't believe this hasn't been asked before, but I really could not find it in previous questions, or in the plotly documentation. Apologies if this turns out to be a duplicate question.