R 绘图图合并

R 绘图图合并,r,plotly,subplot,R,Plotly,Subplot,我试图在一个视图中合并不同的绘图。我遇到的问题是标准的subplot()函数将绘图合并在一起。有没有办法将它们分开,例如,ggplot的par(mfrow)或grid.arrange()函数 #方框图(bp) bxp谢谢你,这样做的问题是我失去了plotly提供的交互性。 # Box plot (bp) bxp <- ggboxplot(ToothGrowth, x = "dose", y = "len", color = "dose", palette

我试图在一个视图中合并不同的绘图。我遇到的问题是标准的
subplot()
函数将绘图合并在一起。有没有办法将它们分开,例如,ggplot的
par(mfrow)
grid.arrange()
函数

#方框图(bp)

bxp谢谢你,这样做的问题是我失去了plotly提供的交互性。
# Box plot (bp)
bxp <- ggboxplot(ToothGrowth, x = "dose", y = "len",
                 color = "dose", palette = "jco")
bxp
# Dot plot (dp)
dp <- ggdotplot(ToothGrowth, x = "dose", y = "len",
                 color = "dose", palette = "jco", binwidth = 1)

# Bar plot (bp)
bp <- ggbarplot(mtcars, x = "name", y = "mpg",
          fill = "cyl",               # change fill color by cyl
          color = "white",            # Set bar border colors to white
          palette = "jco",            # jco journal color palett. see ?ggpar
          sort.val = "asc",           # Sort the value in ascending order
          sort.by.groups = TRUE,      # Sort inside each group
          x.text.angle = 90           # Rotate vertically x axis texts
          )
bp + font("x.text", size = 8)
# Scatter plots (sp)
sp <- ggscatter(mtcars, x = "wt", y = "mpg",
                add = "reg.line",               # Add regression line
                conf.int = TRUE,                # Add confidence interval
                color = "cyl", palette = "jco", # Color by groups "cyl"
                shape = "cyl"                   # Change point shape by groups "cyl"
                )+
  stat_cor(aes(color = cyl), label.x = 3)       # Add correlation coefficient
sp

ggarrange(bxp, dp, bp + rremove("x.text"), 
          labels = c("A", "B", "C"),
          ncol = 2, nrow = 2)