I am trying to create a holoviews dataset from a 2D image stored as a numpy array. Holoviews provides a fairly comrehensive guide for gridded data sets here: http://holoviews.org/getting_started/Gridded_Datasets.html
In the example linked above they create a dataset from a 3D numpy array (time, x, y) as follows:
ds = hv.Dataset((np.arange(50), np.arange(111), np.arange(62), calcium_array),
kdims=['Time', 'x', 'y'], vdims=['Fluorescence'])
ds
where calcium_array
is a numpy array with shape (50,11,62).
This works fine for me running Python 3.6, And holoviews version 1.8.4-x-gde78cf33a
When I try to modify the example for a simple 2D image like so
ds = hv.Dataset((np.arange(111), np.arange(62), calcium_array[0,:,:]),
kdims=[ 'x', 'y'], vdims=['Fluorescence'])
ds
I get the exception
ValueError: None of the available storage backends were able to support the supplied data format.
My modifications to the working example code basically boil down to dropping the first dimension both in the array as well as the kdims
. Am I doing something wrong or is this a bug ?
Try:
ds = hv.Dataset((np.arange(50), np.arange(111), np.arange(62), calcium_array),
kdims=['Time', 'x', 'y'], vdims=['Fluorescence'])
ds
=> :Dataset [Time,x,y] (Fluorescence)
ds = hv.Dataset((np.arange(50), np.arange(111), calcium_array[0,:,:]),
kdims=['x', 'y'], vdims=['Fluorescence'])
ds
=> :Dataset [x,y] (Fluorescence)
Maybe we need a better error message.