Skip to content

Instantly share code, notes, and snippets.

@shanmdphd
Created March 5, 2019 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanmdphd/aceac7d8bc9df68a2fa4808a63b16ec9 to your computer and use it in GitHub Desktop.
Save shanmdphd/aceac7d8bc9df68a2fa4808a63b16ec9 to your computer and use it in GitHub Desktop.
ggforce 패키지를 사용해서 여러 페이지가 있는 PDF 파일 만들기.
library(tidyverse)
library(ggforce)
# 함수 정의 ----
plot_multiple <- function(page_num) {
Theoph %>%
ggplot(aes(Time, conc)) +
geom_point() +
geom_line(alpha = 0.1) +
ggforce::facet_wrap_paginate(~Subject, ncol = 2, nrow = 2, page = page_num)
}
# pdf 만들기 ----
pdf('ggforce-multiple-pdf.pdf')
plot_multiple(1)
plot_multiple(2)
plot_multiple(3)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment