On Aug 23, 2009, at 11:29 PM, Hemavathi Ramulu wrote:
Hi everyone,
I want to plot some pattern. For example, I have some coding as below,
plot(0:11,type="n")
polygon(c(6,8,10), c(7,3,5),bor=6)
polygon(c(2,4,6), c(5,3,7),bor=6)
polygon(c(6,10,8), c(7,9,11),bor=6)
polygon(c(2,6,4), c(9,7,11),bor=6)
This coding will give me four triangles, but how to generate more
triangles
in sequences so
that not need to mention the coordinate for each triangle?
plot(0:11,type="n")
for (i in 1:10 ) polygon (sample(1:10, 3), sample(1:10, 3), bor=6)
or perhaps:
plot(0:11,type="n")
for (i in 1:10 ) polygon (i*c(.2, .6, .8), i*c(.9,.7, 1.1), bor=6)
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
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.