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 [holoviews.org
import numpy as np
import holoviews as hv
from holoviews import dim, opts
hv.extension('matplotlib')
Load the data#
import io
try: from urllib2 import urlopen
except: from urllib.request import urlopen
raw = urlopen('http://assets.holoviews.org/data/mandelbrot.npy').read()
array = np.load(io.BytesIO(raw)).astype(np.float32)
Plot#
dots = np.linspace(-0.45, 0.45, 19)
fractal = hv.Image(array)
# First example on the old holoviews.org 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().cols(2)
layout.opts(
opts.Contours(color='w', show_legend=False),
opts.Points(s=dim('z')*50))
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.
Download this notebook from GitHub (right-click to download).