[R] Obtaining figures with exactly placed points

2007-03-06 Thread Scionforbai
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  0 0  0   0 

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  in the
R ouput. Why is the R ouput still scaled? Do I miss some graphic
parameter?

Any tip is appreciated,
marco

__
R-help@stat.math.ethz.ch 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.


Re: [R] Obtaining figures with exactly placed points

2007-03-06 Thread Scionforbai
 plot(0,0,n,xlim=c(0,1),ylim=c(0,1),axes=F,ann=F,xaxs='i',yaxs='i')

It was exactly this!

 *8/100+
[1] 1199.88

Thanks,
Marco

__
R-help@stat.math.ethz.ch 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.


Re: [R] Obtaining figures with exactly placed points

2007-03-06 Thread Greg Snow
Try:

plot(0,0,n,xlim=c(0,1),ylim=c(0,1),axes=F,ann=F,xaxs='i',yaxs='i')

To see if that fixes it for you (without the xaxs and yaxs arguments it
adds 4% of the range to each side so that any points plotted do not fall
to close to the axes.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Scionforbai
 Sent: Tuesday, March 06, 2007 2:42 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Obtaining figures with exactly placed points
 
 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  0 0  0   0 
 
 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 
  in the R ouput. Why is the R ouput still scaled? Do I 
 miss some graphic parameter?
 
 Any tip is appreciated,
 marco
 
 __
 R-help@stat.math.ethz.ch 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.


__
R-help@stat.math.ethz.ch 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.