Saving files in HoloViews
In [3]:
import holoviews
%load_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]:
In [6]:
!ls *png
In [7]:
%%output filename="Image-Pattern-Gaussian" fig="svg"
fig # Saves Image-Pattern-Gaussian.svg
Out[7]:
In [8]:
!ls *.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]:
Another way is to use automatic archiving of the files produced in the notebook.
This is started by issuing the following command:
In [10]:
holoviews.archive.auto()
And run the whole notebook, every single display will be output appropriately using the chosen naming scheme! This means you can define the filename format you want to use for entire blocks of the notebook.
In [11]:
fig + fig
Out[11]:
In [12]:
fig + holomap
Out[12]: