## The Hilbert curve transforms a 2-dim. function into a time series.
z <- fractalcurve(4, which = "hilbert")
## Not run:
# f1 <- function(x, y) x^2 + y^2
# plot(f1(z$x, z$y), type = 'l', col = "darkblue", lwd = 2,
# ylim = c(-1, 2), main = "Functions transformed by Hilbert curves")
#
# f2 <- function(x, y) x^2 - y^2
# lines(f2(z$x, z$y), col = "darkgreen", lwd = 2)
#
# f3 <- function(x, y) x^2 * y^2
# lines(f3(z$x, z$y), col = "darkred", lwd = 2)
# grid()## End(Not run)
## Not run:
# ## Show some more fractal surves
# n <- 8
# opar <- par(mfrow=c(2,2), mar=c(2,2,1,1))
#
# z <- fractalcurve(n, which="dragon")
# x <- z$x; y <- z$y
# plot(x, y, type='l', col="darkgrey", lwd=2)
# title("Dragon Curve")
#
# z <- fractalcurve(n, which="molecule")
# x <- z$x; y <- z$y
# plot(x, y, type='l', col="darkblue")
# title("Molecule Curve")
#
# z <- fractalcurve(n, which="arrowhead")
# x <- z$x; y <- z$y
# plot(x, y, type='l', col="darkgreen")
# title("Arrowhead Curve")
#
# z <- fractalcurve(n, which="snowflake")
# x <- z$x; y <- z$y
# plot(x, y, type='l', col="darkred", lwd=2)
# title("Snowflake Curve")
#
# par(opar)## End(Not run)
Run the code above in your browser using DataLab