cantor | R Documentation |
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.
cantor(n = 5, plot = FALSE, add = FALSE, Y = 0, lty = 1, col = "black", ...)
n |
an integer value controling the number of recursive levels. |
plot |
logical. If |
add |
logical (only used if |
Y |
y-value for the plot (only used if |
lty |
line type (see |
col |
colour of the Cantor lines. |
... |
optional arguments to be passed on to |
a square matrix with 0s and 1s.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.