[R] Obtaining figures with exactly placed points

Scionforbai scionforbai at gmail.com
Tue Mar 6 22:42:14 CET 2007


Dear list,

I have to plot some geometrical shape given as list of points. My need
is the following: let's say my shape is a 1 inch large square; how can
I plot it with R in a graphic format that gives me an image *exactly*
1 inch large? I tried to set oma, mar and fin parameters, but with no
success.

I'm currently using the xfig driver for the final images are to be
included in latex documents, so I can easily add latex mathematical
text and other things; however, other formats (pdf, eps) will do.

The piece of code:

xfig("R2fig.fig")
par(mar=c(0,0,0,0),oma=c(0,0,0,0),fin=c(1,1))#no margin, figure
dimension 1x1 inch
plot(0,0,"n",xlim=c(0,1),ylim=c(0,1),axes=F,ann=F)
rect(0,0,1,1)
dev.off()

gives me not what I want:
$ cat R2fig.fig
#FIG 3.2
Landscape
Flush left
Inches
A4
100.00
Single
-2
1200 2
# End of XFig header
2 2 0 1 0 -1 100 0 -1 4.000 0 0 -1 0 0 5
         0 1111 0 0 1111 0 1111 1111 0 1111

And this is what it should be (drawn by Xfig itself):
$ cat Xfig.fig
#FIG 3.2
Landscape
Flush left
Inches
A4
100.00
Single
-2
1200 2
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
         0 0 1200 0 1200 1200 0 1200 0 0

The interesting part is the last line; 1200 is replaced by 1111 in the
R ouput. Why is the R ouput still scaled? Do I miss some graphic
parameter?

Any tip is appreciated,
marco



More information about the R-help mailing list