cantor {geostats}R Documentation

Cantor set

Description

Calculates or plots a Cantor set of fractal lines, which is generated using a recursive algorithm that is built on a line segment whose middle third is removed. Each level of recursion replaces each black line by the same pattern.

Usage

cantor(n = 5, plot = FALSE, add = FALSE, Y = 0, lty = 1, col = "black", ...)

Arguments

n

an integer value controling the number of recursive levels.

plot

logical. If TRUE, the Cantor set is plotted, otherwise a list of breaks and counts is returned.

add

logical (only used if plot=TRUE). If add=FALSE, then a brand new figure is created; otherwise the Cantor set is added to an existing plot.

Y

y-value for the plot (only used if plot=TRUE).

lty

line type (see pars() for details)

col

colour of the Cantor lines.

...

optional arguments to be passed on to matplot or matlines.

Value

a square matrix with 0s and 1s.

Examples

plot(c(0,1),y=c(0,1),type='n',bty='n',ann=FALSE,xaxt='n',yaxt='n',xpd=NA)
cantor(n=0,Y=1.00,plot=TRUE,add=TRUE)
cantor(n=1,Y=0.75,plot=TRUE,add=TRUE)
cantor(n=2,Y=0.50,plot=TRUE,add=TRUE)
cantor(n=3,Y=0.25,plot=TRUE,add=TRUE)
cantor(n=4,Y=0.00,plot=TRUE,add=TRUE)

[Package geostats version 1.6 Index]