Yigael Satanower
Yigael Satanower

Reputation: 209

how can i change the size of a png file with R

I am plotting png files and getting a small picture.

Do you know some simple code that can change size of a png plot?

(my plots are too high and too "slim".

In addition is there a way to change resolution of the plot ?

thanks yigeal

Upvotes: 10

Views: 27326

Answers (1)

Brandon Bertelsen
Brandon Bertelsen

Reputation: 44648

?png

png(filename = "Rplot%03d.png", width = 480, height = 480,
    units = "px", pointsize = 12, bg = "white", res = NA,
    restoreConsole = TRUE)

Change width and height in pixels, set res in dpi, default is 72 for larger plots I generally use something around 120. You'll have to play with it to get the font to look how you want it.

Example:

png()
plot(rnorm(100))
dev.off()

Upvotes: 26

Related Questions