R/litir.R

Defines functions litir

Documented in litir

litir <-
function(n)
{
        x <- c(1:(n + 1))
         plot(x, x)
        y <- x
        for(j in 1:(n - 1)) {
                for(i in 1:(n + 1)) {
                        polygon(c(x[i], x[i + 1], x[i + 1], x[i]), c(y[j],
                                y[j], y[j + 1], y[j + 1]), col = ((j - 1) *
                                n + i - 1))
                        lines(c(x[i], x[i + 1], x[i + 1], x[i], x[i]), c(y[
                                j], y[j], y[j + 1], y[j + 1], y[j]), col = 1)
                        text((x[i] + x[i + 1])/2, (y[j] + y[j + 1])/2,
                                as.character((j - 1) * n + i - 1))
                }
        }
        return(invisible())
}

Try the geo package in your browser

Any scripts or data that you put into this service are public.

geo documentation built on May 2, 2019, 5:22 p.m.