[R] Simple graphics

Alberto Vieira Ferreira Monteiro albmont at centroin.com.br
Sun Oct 1 19:08:15 CEST 2006


Jim Holtman wrote:
>
> Is this what you want?  You have to reset the margins:
>
> png("file.png", width=200, height=200)
> par(mar=c(0,0,0,0))  # reset margins
> plot(0, xlim=c(0,200), ylim=c(0,200), type='n')
>  polygon(c(50, 50, 150, 150), c(50, 150, 150, 50))
>  dev.off()
>
Yes and no. This sort-of does what I want, except that it
has no precision! After I edit the file.png with a graphic editor,
I notice that the rectangle does not have 100 x 100 pixels
in the sides, because the vertices are in weird points (instead of
(50,50) to (150,150), they are from (53,53) to (146,146))

Alberto Monteiro



More information about the R-help mailing list