wilkelab / cowplot

cowplot: Streamlined Plot Theme and Plot Annotations for ggplot2
https://wilkelab.org/cowplot/
701 stars 84 forks source link

plot_grid not working #195

Closed tuinhommel closed 1 year ago

tuinhommel commented 1 year ago

Hi,

I have a problem with running plot_grid. The same code that worked before suddenly stopped working. I went over the examples again and I cannot find any problems in the code or the graphs used. To be sure, I updated everything (R, RStudio, ggplot2 and cowplot). But nothing seems to help. I keep getting an "unused arguments" error.

When taking your example code I also get an error.

df <- data.frame(x = 1:10, y1 = 1:10, y2 = (1:10)^2, y3 = (1:10)^3, y4 = (1:10)^4) p1 <- ggplot(df, aes(x, y1)) + geom_point() p2 <- ggplot(df, aes(x, y2)) + geom_point() p3 <- ggplot(df, aes(x, y3)) + geom_point() p4 <- ggplot(df, aes(x, y4)) + geom_point() p5 <- ggplot(mpg, aes(as.factor(year), hwy)) + geom_boxplot() + facet_wrap(~class, scales = "free_y")

simple grid

plot_grid(p1, p2, p3, p4)

Error in plot_grid(p1, p2, p3, p4) : unused argument (p4)

Right now, I am using R version 4.3.1, ggplot2 version 3.4.2, and cowplot version 1.1.1, but it already stopped working before I updated.

Thank you for your time.

tuinhommel commented 1 year ago

Ohhh sorry, I think sjPlot was the culprit, it also has a function called plot_grid. If I use cowplot::plot_grid it works.