Saving files in HoloViews

Here, we show how to save files from figures generated with HoloViews. This was thoroughly explained in this page.

In [3]:
import holoviews
%load_ext holoviews.ipython
The holoviews.ipython extension is already loaded. To reload it, use:
  %reload_ext holoviews.ipython
In [4]:
import imagen
fig = imagen.Gaussian()[:]
In [5]:
%%output filename="Image-Pattern-Gaussian" fig="png"
imagen.Gaussian()[:]  # Saves Image-Pattern-Gaussian.png
Out[5]:
No description has been provided for this image
In [6]:
!ls *png
Image-Pattern-Gaussian.png  __temp__.png
In [7]:
%%output filename="Image-Pattern-Gaussian" fig="svg"
fig   # Saves Image-Pattern-Gaussian.svg
Out[7]:
No description has been provided for this image
In [8]:
!ls *.svg
Image-Pattern-Gaussian.svg
In [9]:
%%output filename="Image-Pattern-Gaussian" holomap="gif"
import numpy as np
from holoviews import HoloMap, VectorField

holomap = HoloMap()
steps = np.linspace(-2.5, 2.5, 41)
x,y = np.meshgrid(steps, steps)
sine_rings  = np.sin(x**2+y**2)*np.pi+np.pi
exp_falloff = 1/np.exp((x**2+y**2)/15)

for deg in np.linspace(0, 360, 128, endpoint=False):
    vector_data = np.array([x.flatten()/5., y.flatten()/5., 
                             np.sin(deg*2*np.pi/360)*sine_rings.flatten(),
                             exp_falloff.flatten()]).T
    holomap[deg] = VectorField(vector_data, group='Sine Ring')
holomap
Out[9]: