Often I am in a position when I have to adjust the size of the output image. Unfortunately, it means that usually I have to adjust font size, to make things readable.
For example, if the following plot
library(ggplot2)
library(tibble)
library(stringi)
set.seed(1)
df <- tibble(
x = stri_rand_strings(10, 20),
y = runif(10) * 10,
label = stri_rand_strings(10, 10)
)
p <- ggplot(df, aes(x, y)) +
geom_text(aes(label = label)) +
scale_x_discrete(position = "top") +
theme(axis.text.x = element_text(angle = 90, hjust = 0))
is saved to 12'' x 6'' image things look pretty good:
p + ggsave("test_small.png", width = 12, height = 6, unit = "in")
however if I increase dimensions to 36'' x 18'' the fonts are unreadble:
p + ggsave("test_large.png", width = 36, height = 18, unit = "in")
Is there any general strategy which allows us to change output resolution without constant tinkering with the font sizes?