0

我有这个代码

g=ggplot(a, aes(x = TIME, y = DV,group = ID))
g + geom_point(data = a,  colour="red", size=2) +
    theme_bw() +
    geom_smooth(method = 'loess', se = FALSE,colour="black") +
    facet_wrap( ~ ID, ncol = 4,nrow = 6, scales = 'free')

我在一页上得到一个 6*4 = 24 个方面的图。如何将它分成 2 页,每页有 12 个单独的图?

4

1 回答 1

0

举个例子:

library(tidyverse); library(ggforce)

p <- mtcars %>%
  rownames_to_column("model") %>%
  ggplot(aes(wt, mpg, label = model)) +
  geom_text(size = 2) +
  coord_cartesian(clip = "off")

p + facet_wrap_paginate(~model, nrow = 4, ncol = 4, page = 1)
p + facet_wrap_paginate(~model, nrow = 4, ncol = 4, page = 2) 
于 2018-12-26T08:34:32.487 回答