Open nitrocalcite opened 3 years ago
Interesting! The reason seems to be bokeh, not holoviews. Check out the following where I replaced top
by left
:
import xarray as xr
import numpy as np
import holoviews as hv
hv.extension('bokeh')
arr = np.random.rand(7,8)
ds_top = xr.Dataset({
'left': (('ard', 'issab'), arr)
}, coords={
'ard': np.arange(7),
'issab': np.array([4,6,8,10,12,15,20,25])
})
ds_data = xr.Dataset({
'data': (('ard', 'issab'), arr)
}, coords={
'ard': np.arange(7),
'issab': np.array([4,6,8,10,12,15,20,25])
})
# differing results (do not have to be in a Layout; just so they are easy to compare)
l = hv.QuadMesh(ds_top['left']) + hv.QuadMesh(ds_data['data']) + hv.Image(ds_top['left']) + hv.Image(ds_data['data'])
l.apply.opts(tools=['hover'])
The reason seems to be how bokeh's Quad glyphs are defined:
source = ColumnDataSource(dict(
left=foo,
top=bar,
right=baz,
bottom=bonk,
)
)
Would have to see in the holoviews codebase if one can easily avoid these namespace clashes.
Description of expected behavior and the observed behavior
When I use
hv.QuadMesh
to plot an xarray dataset with a field named "top", it seemingly makes up its own data. I expect to see my data.hv.Image
doesn't show this behavior. Changing the field name to anything else results in the usual behavior.Screenshots or screencasts of the bug in action
Complete, minimal, self-contained example code that reproduces the issue
The first one,
hv.QuadMesh(ds_top['top'])
, is all black, while the others plot correctly. If you enable the hovertool,.opts(tools=['hover'])
, you'll notice thathv.QuadMesh(ds_top['top'])
gives different numbers than the rest of the plots, despite the scale being set correctly; that's why it's all black. It's not clear to me where these numbers come from.Note that
ds_top['top']
evaluates to anxs.DataArray
namedtop
, whereasds_data['data']
has the same name but is nameddata
. As far as I can tell, that's the only difference. Either way, all four of these graphs should be showing the same data.ALL software version info
bokeh 2.2.3
holoviews 1.13.5
notebook 6.1.5
Windows 10/Chrome & FirefoxI did a quick search for "top" in the Holoviews codebase but didn't see anything particularly notable. This seems pretty bizarre...can anyone else reproduce? A workaround is to simply not name anything 'top'. Please let me know if I'm missing something embarrassingly obvious. Thanks!