How can I change plot size, figure size and device size? The examples availble for par() function are not very helpful. Would you please give a very simple example?
Best Regards
_________________________________________________________________
Show them the way! Add maps and directions to your party invites.
[[alternative HTML version deleted]]
______________________________________________
R-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
par("din") # in inches
The figure size is the device size less the "outer margin". This is
often the same as the device size, unless you explicitly set the outer
margins:
par(oma=...) # in lines of text
OR
par(omi=...) # in inches
To find out what the figure size is:
par("fin") # in inches
The plot size is the figure size less the margin. To find out what it is:
par("pin") # in inches
OR
par("usr") # in user units
So you could set up the three like this:
x11(width=9,height=6)
par(oma=c(1,1,1,1)) # allow space for one line of text on each side
par(mar=c(0,4,3,2)) # allow this much space for lines of text inside the
figure
Jim
MA> How can I change plot size, figure size and device size? The
MA> examples availble for par() function are not very helpful. Would
MA> you please give a very simple example?
It would be easier if you would tell what exactly you want to do. I
believe the easiest way is not par but the options of the device. For
example:
png("myplot.png",width=400,height=400)
plot(...)
dev.off()
vs.:
png("myplot.png",width=800,height=400)
plot(...)
dev.off()
hth
Stefan
MA> I also found this way much easier. But when to have figure on MS
MA> Word, it is copied and then pasted on MS word then minor pixels
MA> appears. How to get a clear figure?
Use another device. I personally use *.eps which can be obtained by:
postscript("myplot.eps",width=8,height=8,paper="special",horizontal=F)
plot(...)
dev.off()
note that width and height are different here to the png device where
the size is in points.
You can use this in word 200x but note that the plot will look ugly on
the screen. It will look great when you print it with a postscript
printer or when you produce a pdf out of that word file.
Look also here on how you could produce wmf/emf files:
http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export#exporting_r_graphs_-_cross-platform_solutions