[R] Simple graphics

jim holtman jholtman at gmail.com
Sat Sep 30 03:53:59 CEST 2006


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()



On 9/29/06, Alberto Vieira Ferreira Monteiro <albmont at centroin.com.br> wrote:
> Is there any way that I can do something like this:
>
>  png("file.png", width=200, height=200)
>  polygon(c(50, 50, 150, 150), c(50, 150, 150, 50))
>  dev.off()
>
> and then have a png file with a 100 x 100 pixels rectangle in the middle
> of it? It seems that when I call "plot", it redefines the image coordinates
> to some "optimized" value and then I lose any information to draw
> exactly what I want.
>
> Alberto Monteiro
>
> ______________________________________________
> 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list