Re: [R] facet_wrap(nrow) ignored

2020-09-10 Thread Ivan Calandra
Thank you Ulrik for the suggestions. I was thinking of a similar approach using a nested patchwork (which would be easier for me). It's just a shame that it is not possible to force a number of rows. It's good that ggplot2 tries to do things in the most "appropriate" way, but at some point, when

Re: [R] facet_wrap(nrow) ignored

2020-09-10 Thread Ulrik Stervbo via R-help
Dear Ivan, I don't think it is possible to force a number of rows - but I'm honestly just guessing. What you can do is to add an empty plot. Here I use cowplot, but gridExtra should also work well. I add an indication of the row number for the plot to the initial data.frame, and loop over

[R] facet_wrap(nrow) ignored

2020-09-09 Thread Ivan Calandra
Dear useRs, I have an issue with the argument nrow of ggplot2::facet_wrap(). Let's consider some sample data: mydf <- data.frame(grp = rep(letters[1:6], each = 15), cat = rep(1:3, 30), var = rnorm(90)) And let's try to plot with 5 rows: library(ggplot2) ggplot(data = mydf, aes(x = cat, y =