Generates Views on the Mandelbrot Set

Estimates membership for the Mandelbrot set.

Curious whether your favourite complex number is a member of the Mandelbrot set?

—No? Then probably you just want to draw pretty pictures.

Install with:



mb <- mandelbrot()

Pretty colours:

mb <- mandelbrot(xlim = c(-0.8438146, -0.8226294),
                 ylim = c(0.1963144, 0.2174996), 
                 iterations = 500, resolution = 800)
cols <- mandelbrot_palette(RColorBrewer::brewer.pal(11, "Spectral"), fold = FALSE)
plot(mb, col = cols)

Experiment with transforms:

par(mfrow = c(1, 2), pty = "s", mar = rep(0, 4))
plot(mb, col = cols, transform = "inverse")
plot(mb, col = cols, transform = "log")

Don't like image? Convert to a data.frame and use with ggplot2:

mb <- mandelbrot(xlim = c(-0.8335, -0.8325),
                 ylim = c(0.205, 0.206), 
                 resolution = 1200L,
                 iterations = 1000)
# weird uneven palette made for a heatmap viz:
cols <- c(
  colorRampPalette(c("#e7f0fa", "#c9e2f6", "#95cbee",
                     "#0099dc", "#4ab04a", "#ffd73e"))(10),
  colorRampPalette(c("#eec73a", "#e29421", "#e29421", 
                     "#f05336","#ce472e"), bias=2)(90), 
df <-
ggplot(df, aes(x = x, y = y, fill = value)) +
  geom_raster(interpolate = TRUE) + theme_void() +
  scale_fill_gradientn(colours = cols, guide = "none") 

mandelbrot0 is a faster interface for

See also

shinybrot is a Shiny web app that enables interactive exploration of the Mandelbrot set as generated by this package.

Hosted on shinyapps:



mandelbrot 0.2.0

  • Added a file to track changes to the package.
  • Uploaded to CRAN w/ CRAN related fixes
  • Tweaked interfaces for plot.mandelbrot and mandelbrot_palette

mandelbrot 0.1.0

  • First release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.2.0 by Ben Moore, 4 years ago

Browse source code at

Authors: Ben Moore [aut, cre] , Mario dos Reis [aut]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports reshape2

Suggests testthat, RColorBrewer

See at CRAN