divy
divy

Reputation: 41

A hybrid way to produce high resolution ggplot image using RStudio's export function?

I am using ggplot2 with RStudio to produce a 300 dpi image. However the method using "tiff("test.tif"...)" produced a wired image with very big text and very small plot; while the export function in RStudio is convenient to use with helpful interactive graphics to scale but falls short in producing a low resolution 72 dpi image. Is there any hybrid way with the both high resolution and interactive image operations?

Upvotes: 3

Views: 1692

Answers (1)

Roman
Roman

Reputation: 4989

Answered in comments:

1. Create a plot

library(ggplot2)
ggplot(mtcars, aes(mpg, wt)) + geom_point()

2. Save it via ggsave()

> ggsave("mtcars.pdf")
Saving 4.11 x 4.08 in image

3. Play with the scale = argument

> ggsave("mtcars.pdf", scale = 2)
Saving 8.23 x 8.17 in image

The proportions should stay the same.

Upvotes: 1

Related Questions