Skip to content

Commit

Permalink
Allow plotting partially irregular QuadMesh
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Sep 12, 2019
1 parent a1e0c03 commit b1e8a31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion holoviews/core/data/xarray.py
Expand Up @@ -50,7 +50,7 @@ def shape(cls, dataset, gridded=False):
if kd.name in array.dims][::-1]
if not all(d in names for d in array.dims):
array = np.squeeze(array)
array = array.transpose(*names)
array = array.transpose(*names, transpose_coords=False)
shape = array.shape
if gridded:
return shape
Expand Down
15 changes: 11 additions & 4 deletions holoviews/core/util.py
Expand Up @@ -1819,10 +1819,17 @@ def expand_grid_coords(dataset, dim):
dataset into an ND-array matching the dimensionality of
the dataset.
"""
arrays = [dataset.interface.coords(dataset, d.name, True)
for d in dataset.kdims]
idx = dataset.get_dimension_index(dim)
return cartesian_product(arrays, flat=False)[idx].T
irregular = [d.name for d in dataset.kdims
if d is not dim and dataset.interface.irregular(dataset, d)]
if irregular:
array = dataset.interface.coords(dataset, dim, True)
example = dataset.interface.values(dataset, irregular[0], True, False)
return array * np.ones_like(example)
else:
arrays = [dataset.interface.coords(dataset, d.name, True)
for d in dataset.kdims]
idx = dataset.get_dimension_index(dim)
return cartesian_product(arrays, flat=False)[idx].T


def dt64_to_dt(dt64):
Expand Down
3 changes: 2 additions & 1 deletion holoviews/plotting/bokeh/raster.py
Expand Up @@ -207,7 +207,8 @@ def get_data(self, element, ranges, style):
cmapper = self._get_colormapper(z, element, ranges, style)
cmapper = {'field': z.name, 'transform': cmapper}

irregular = element.interface.irregular(element, x)
irregular = (element.interface.irregular(element, x) or
element.interface.irregular(element, y))
if irregular:
mapping = dict(xs='xs', ys='ys', fill_color=cmapper)
else:
Expand Down

0 comments on commit b1e8a31

Please sign in to comment.