I am trying to learn ggplot with facet. here is the codes works in Rstudio
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
# With one variable
p + facet_grid(. ~ cyl)
however, it shows error for ncol after I added ncol=2 :
p + facet_grid( ~ cyl,ncol=2)
Error in facet_grid(~cyl, ncol = 2) : unused argument (ncol = 2)
#use facet_wrap
p + facet_wrap( ~ cyl, ncol = 2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With