Search code examples
rplotresolution

Plots with good resolution for printing and screen display


I was making my plots using

dev.new(width=5.8, height=3) 
par(mfrow=c(1,3),mar=c(1,1,2,1),oma=c(4,1,2,0),mgp=c(3, 0.5, 0)) 
plot(...)

and coping and pasting them into Microsoft Word. They look really good in Word (I tried different widths until I found one that worked well) but when I printed them they looked terrible. After some web searching I found the resolution for printing should be at least 300ppi. So after fiddling with widths and heights for an eternity I came out with code that makes the plots look the same size but with a better resolution:

png(file="mag_feb.png",width=1800,height=950,res=300)

They now look good when printed, but they don't look sharp at all in Word (on screen). Could it be a problem with size? Isn't there a way to make graphs that look good printed and on screen? I already spent hours with this and can't think of anything else to try, so any help will be very much appreciated!

Thanks!


Solution

  • There is a small error in your original png command. Try this:

    png(file="mag_feb.png", units="in", width=11, height=8.5, res=300)
    

    Now, width and height are in inches, and res is in pixels/inch. Before, the res parameter was being ignored.