Mandelbrot Section#

Download this notebook from GitHub (right-click to download).

Most examples work across multiple plotting backends, this example is also available for:

HoloViews demo that used to be showcased on the [

import numpy as np
import holoviews as hv
from holoviews import dim, opts

Load the data#

import io
try:    from urllib2 import urlopen
except: from urllib.request import urlopen

raw = urlopen('').read()
array = np.load(io.BytesIO(raw)).astype(np.float16)[::2,::2]


dots = np.linspace(-0.45, 0.45, 19)
fractal = hv.Image(array)

# First example on the old homepage was:
# ((fractal * hv.HLine(y=0)).hist() + fractal.sample(y=0))
layouts = {y: (fractal * hv.Points(fractal.sample([(i,y) for i in dots])) +
               fractal.sample(y=y) +
               hv.operation.threshold(fractal, level=np.percentile(fractal.sample(y=y)['z'], 90)) +
               hv.operation.contours(fractal, levels=[np.percentile(fractal.sample(y=y)['z'], 60)]))
            for y in np.linspace(-0.3, 0.3, 21)}

layout = hv.HoloMap(layouts, kdims='Y').collate()

    opts.Contours(color='w', show_legend=False),