[R] Obtaining figures with exactly placed points

Greg Snow Greg.Snow at intermountainmail.org
Tue Mar 6 23:18:16 CET 2007


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
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Scionforbai
> Sent: Tuesday, March 06, 2007 2:42 PM
> To: r-help at 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 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
> 
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list