thomasp85 / patchwork

The Composer of ggplots
https://patchwork.data-imaginist.com
Other
2.42k stars 157 forks source link

'Index out of bound' when trying to 'View()' the plot associated list #317

Closed lucavd closed 11 months ago

lucavd commented 1 year ago

Hi @thomasp85 ,

I think there's a bug (maybe related to #217).

library(ggplot2)
library(patchwork)

p1 = ggplot(mtcars, aes(x = factor(cyl), y = mpg)) + geom_violin()
p2 = ggplot(mtcars, aes(x = factor(cyl), y = mpg)) + geom_boxplot()
p = p1 + p2
str(p, max.level = 1)

But

> View(p)
Error: Index out of bounds

I tried on different machines and different OS (even server) and different RStudio versions. Same error patchwork version 1.1.2 from CRAN

mschilli87 commented 1 year ago

I get

Error in as.data.frame.default(x) :
  cannot coerce class ‘c("patchwork", "gg", "ggplot")’ to a data.frame

:shrug: