[R] Re: Mandelbrot set and C code

Jason Turner jasont at indigoindustrial.co.nz
Wed Oct 1 22:09:49 CEST 2003


ucgamdo at ucl.ac.uk wrote:

>       I decided to take on the 'proper' solution to calculate the
> Mandelbrot set in R, i.e. to do the raw calculations in C and then link
> that code with R. 

This is very cool.  I did a slight tweak to your mandelbrot.R code, so 
that x can be a list with components x and y.  This allows you to keep 
zooming in using your mouse to click on the plot (one of the incredibly 
nifty features of such sets).

Using the "tweaked" version below, call the function as you suggested:

image(mandelbrot(), col = c(heat.colors(49), "black"))

Then use locator(2) to define your next view:

image(mandelbrot(locator(2)), col = c(heat.colors(49), "black"))

Click the mouse in the corners of the zoom window, and away you go. 
Lather. Rinse. Repeat.

Cheers

Jason
-- 
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
jasont at indigoindustrial.co.nz




More information about the R-help mailing list