I want to export this patchwork plot so that the overall dimensions are exactly 180 pt wide and 170 pt high (see here:
Figures are best prepared at a width of 90 mm (single column) and 180 mm (double column) with a maximum height of 170mm.. At this size, the font size should be 5-7pt.
whatever the pt means for Nature Cities.
That means each subplot should be about 28 pt wide (since 180 ÷ 6 = 30, minus some spacing).
library(tidyverse)
library(patchwork)
library(ggplot2)
# Dummy dataset: monthly data from 2018 to 2023 for 14 cities
set.seed(123)
dates <- seq(as.Date("2018-01-01"), as.Date("2023-12-01"), by = "month")
cities <- paste0("City", 1:14)
df <- expand.grid(Date = dates, City = cities) %>%
mutate(Value = runif(nrow(.), 0, 100))
# Create 14 plots (one per city)
plots <- lapply(cities, function(cty) {
ggplot(df %>% filter(City == cty), aes(Date, Value)) +
geom_line(color = "steelblue", linewidth = 0.4) +
scale_x_date(date_labels = "%Y", breaks = as.Date(c("2018-01-01","2020-01-01","2022-01-01"))) +
theme_minimal(base_family = "Arial", base_size = 5) +
theme(
axis.title = element_blank(),
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
legend.position = "none",
plot.title = element_blank()
)
})
# Arrange 6 plots per row
final_plot <- wrap_plots(plots, ncol = 6)
final_plot
How can I export this patchwork plot so that it fits precisely into the specified dimensions (180 pt × 170 pt), with 6 plots per row, no titles, no y-axis labels, no legend, x-axis labels shown, and font size 5 in Arial?
> sessionInfo()
R version 4.5.2 (2025-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26200)
Matrix products: default
LAPACK version 3.12.1
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8
time zone: Europe/Budapest
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] svglite_2.2.2 patchwork_1.3.2 tidyplots_0.3.1 lubridate_1.9.4 forcats_1.0.1 stringr_1.6.0 dplyr_1.1.4 purrr_1.2.0
[9] readr_2.1.6 tidyr_1.3.2 tibble_3.3.0 ggplot2_4.0.1 tidyverse_2.0.0
loaded via a namespace (and not attached):
[1] gtable_0.3.6 compiler_4.5.2 tidyselect_1.2.1 dichromat_2.0-0.1 textshaping_1.0.4 systemfonts_1.3.1 scales_1.4.0
[8] R6_2.6.1 labeling_0.4.3 generics_0.1.4 pillar_1.11.1 RColorBrewer_1.1-3 tzdb_0.5.0 rlang_1.1.6
[15] stringi_1.8.7 S7_0.2.1 timechange_0.3.0 cli_3.6.5 withr_3.0.2 magrittr_2.0.4 grid_4.5.2
[22] rstudioapi_0.17.1 hms_1.1.4 lifecycle_1.0.4 vctrs_0.6.5 glue_1.8.0 farver_2.1.2 ragg_1.5.0
[29] tools_4.5.2 pkgconfig_2.0.3