Open evanliu3594 opened 7 months ago
If you don't mind adding more code, you can write it like this.
p_list <- mtcars %>% split(.$gear) %>% map(~ggplot(.x,aes(x = mpg, y = disp)) + geom_point())
p_list_label <- c(t(matrix(c(names(p_list), rep(NA, (2 * 2) - length(p_list))), nrow = 2, byrow = FALSE)))
plot_grid(plotlist = p_list, ncol = 2, labels = p_list_label, byrow = F)
I wrote this code with reference to the code which is at line181 in plot_grid.R.
If you don't mind adding more code, you can write it like this.
p_list <- mtcars %>% split(.$gear) %>% map(~ggplot(.x,aes(x = mpg, y = disp)) + geom_point()) p_list_label <- c(t(matrix(c(names(p_list), rep(NA, (2 * 2) - length(p_list))), nrow = 2, byrow = FALSE))) plot_grid(plotlist = p_list, ncol = 2, labels = p_list_label, byrow = F)
I wrote this code with reference to the code which is at line181 in plot_grid.R.
Thanks for your solution, I'd like to use it if I have to adjust the label order manually. 😄
Labels are always attached by row.