Вам не нужно использовать count()
на круговых диаграммах, add_pie()
сделает это за вас.
Просто удалите data = count(df, ...)
вашего кода.
Как это:
# yours data
df = data.frame(
seed =c("AUUGCA" ,"CACUGG" ,"UUGUUC" ,"UUUGAU" ,"ACUGGC" ,"AAAUGC" ,"AUCACA" ),
aae=c(2 ,2 ,1 ,1 ,1 ,1 ,8 ),
bge=c(4, 0, 1, 1, 1, 1, 5),
pte =c(3 ,0 ,1 ,1 ,0 ,2 ,9 ),
tca = c(1,10,1,0,1,0,0)
)
library(plotly)
# Make pies
df%>%
plot_ly() %>%
add_pie(labels = ~seed, values = ~aae,
name = "A. aeg", domain = list(row = 0, column = 0)) %>%
add_pie(labels = ~seed, values = ~bge,
name = "B .ger", domain = list(row = 0, column = 1)) %>%
add_pie(labels = ~seed, values = ~pte,
name = "P. tep", domain = list(row = 1, column = 0)) %>%
add_pie(labels = ~seed, values = ~tca,
name = "T. cas", domain = list(row = 1, column = 1))%>%
layout(title = "Pie Charts with Subplots", showlegend = F,
grid=list(rows=2, columns=2),
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
Вот вывод: