Samstag, 30. April 2011

little about plotting

empty plot:
plot(c(0,0),c(100,100),type="n")

add an arrow:
arrows(x1,y1,x2,y2)

double-headed arrow:
arrows(x1,y1,x2,y2, code=3)

other arguments: angle, length, col, lty etc pp

add a rectangle:
rectangle(x1,y1,x2,y2)

add a 5-sided polygon defined by clicking on 5 points:
drawfive <- function(){
coos <- locator(5)
polygon(coos, col="green")
}