simple_layout()
# (to use |> version 4.1.0 of R is required, for lower versions we recommend %>% from magrittr)
library(magrittr)
gridify(
object = ggplot2::ggplot(data = mtcars, ggplot2::aes(x = mpg, y = wt)) +
ggplot2::geom_line(),
layout = simple_layout()
) %>%
set_cell("title", "TITLE") %>%
set_cell("footer", "FOOTER")
gridify(
object = ggplot2::ggplot(data = mtcars, ggplot2::aes(x = mpg, y = wt)) +
ggplot2::geom_line(),
layout = simple_layout(
margin = grid::unit(c(5, 2, 2, 2), "cm"),
global_gpar = grid::gpar(fontsize = 20, col = "blue")
)
) %>%
set_cell("title", "TITLE") %>%
set_cell("footer", "FOOTER")
gridify(
object = ggplot2::ggplot(data = mtcars, ggplot2::aes(x = mpg, y = wt)) +
ggplot2::geom_line(),
layout = simple_layout()
) %>%
set_cell("title", "TITLE\nSUBTITLE", x = 0.7, gpar = grid::gpar(fontsize = 12)) %>%
set_cell("footer", "FOOTER", x = 0.5, y = 0.5, gpar = grid::gpar())
Run the code above in your browser using DataLab