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]:
No description has been provided for this image

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()
Automatic capture is now enabled. [2015-04-27 16:47:36]

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]:
No description has been provided for this image
In [12]:
fig + holomap
Out[12]:


Once Loop Reflect