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
To add a picture to a plot in base R, we first need to read the picture in the appropriate format and then rasterImage function can be used. The most commonly used format for picture in R is PNG. A picture in PNG format can be added to a plot by supplying the values in the plot where we want to add the picture.
?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()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With