Dear all r-users,
 
I have this code below to draw two squares, small and big square.  I would like 
to colour the small square with red and the big square with blue for example.  
I tried using polygon but fail.  Thank you so much for your help.
 
 
par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs="i", yaxs="i")
plot.new()
plot.window(xlim= c(0,8), ylim=c(0,8),col="blue",lwd=3, bg=5)
axis(1)
axis(2)
title(main="The Overall Title")
title(xlab="An x-axis label")
title(ylab="A y-axis label")
box()
#segments(x0, y0, x1, y1, col = par("fg"), lty = par("lty"), lwd = par("lwd"))
segments(0, 0, 4, 0, col=1, lty = 1, lwd = 3)
segments(4, 0, 4, 4, col=2, lty = 1, lwd = 3)
segments(0, 0, 0, 4, col=3, lty = 1, lwd = 3)
segments(0, 4, 4, 4, col=2, lty = 1, lwd = 3)
segments(3, 3, 4, 3, col=5, lty = 1, lwd = 3)
segments(3, 3, 3, 4, col=5, lty = 1, lwd = 3)
polygon(c(3,4) , col="purple")
#grid(nx = NULL, ny = nx, col = "lightgray", lty = "dotted", lwd = par("lwd"), 
equilogs = TRUE)
grid(nx = 8)
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to