Created
December 10, 2021 13:17
-
-
Save k-hench/a56b7db92917b2bb5ea8c3dd5f064b15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
data <- tibble(x = rnorm(50), | |
y1 = rnorm(50), | |
y2 = rnorm(50)+50, | |
y3 = rnorm(50) + 500) | |
p1 <- data |> | |
ggplot(aes(x = x)) + | |
geom_point(aes(y = y1)) + | |
labs(y = "short title") | |
p2 <- data |> | |
ggplot(aes(x = x)) + | |
geom_point(aes(y = y2)) + | |
labs(y = "short title") | |
p3 <- data |> | |
ggplot(aes(x = x)) + | |
geom_point(aes(y = y3)) + | |
labs(y = "very long\ntitle with\ntwo linebreaks") | |
arrangement1 <- cowplot::plot_grid(p1,p2,p3, nrow = 1) | |
library(patchwork) | |
arrangement2 <- p1 + p2 + p3 + plot_layout(nrow = 1) | |
cowplot::plot_grid(arrangement1, arrangement2, ncol = 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment