Ich versuche, zwei Donut-Plots Seite an Seite in Plotly zu bekommen. Ich bekomme jedoch nur ein Bild. Irgendwelche Ratschläge, was ich vermisse?R Plotly Zwei Plots nebeneinander
library(dplyr)
library(plotly)
df1 <- as.data.frame(matrix(data = c("a","b", "c", 34,28, 29), nrow = 3, ncol = 2))
colnames(df1) <- c("category", "count")
df2 <- as.data.frame(matrix(data = c("Q","F", "G", 29,50, 76), nrow = 3, ncol = 2))
colnames(df2) <- c("group", "count")
p <- subplot(
plot_ly(df1, labels = category, values = count, type = "pie", hole = 0.6, showlegend = TRUE),
plot_ly(df2, labels = group, values = count, type = "pie", hole = 0.6, showlegend = TRUE),
margin = 0.05,
nrows = 2
)
p
Stromausgang:
Mit 'domain' wie das von mir erinnert' par (Abb = ..., new = TRUE) 'in Base R. Scheint etwas drakonisch, aber es funktioniert. – r2evans
Super, danke dafür. Warum funktioniert Subplot nicht? Die Unterlagen schlagen das vor? – user1357015
Keine Ahnung, tut mir leid. (Können Sie eine der Antworten "akzeptieren"?) – r2evans