I made a graph with ggplot2 and in RStudio it looks really good. I also can export it manually. Unfortunately, when exporting it with code the text gets super small. I really need it to be exported by code.
Cairo::Cairo(
1200, #length
900, #width
file = paste("cambridge_hashrate_countries_lollipop", ".png", sep = ""),
type = "png", #tiff
bg = "white", #white or transparent depending on your requirement
dpi = 300,
units = "px" #you can change to pixels etc
)
plot
logo <- image_read("../pics/logo_twitter-account.jpg")
grid::grid.raster(logo, x = 0.07, y = 0.03, just = c('left', 'bottom'), width = unit(0.5, 'inches'))
dev.off()
I also tried ggsave() same awful result.
How do I know what setting to choose to export it as RStudio?
Playing with dpi, height and width works, but then the labels are not properly displayed:


