holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.7k stars 404 forks source link

redim.range with doesn't work with QuadMesh #1870

Closed rabernat closed 7 years ago

rabernat commented 7 years ago

It appears like redim.range has no effect with QuadMesh objects. I will use a slightly modified example from the QuadMesh docs

n = 8  # Number of bins in each direction
xs = np.logspace(1, 3, n)
ys = np.linspace(1, 10, n)
zs = np.arange((n-1)**2).reshape(n-1, n-1)
qmesh = hv.QuadMesh((xs, ys, zs))
print(qmesh.range('z'))
qmesh.redim.range(z=(1,2))
print(qmesh.range('z'))

prints

(0, 48)
(0, 48)

Looking closely at the the example, you can see this bug is at work there as well. The third figure calls redim to "set the z-dimension range to maintain the full color range of the colormap". There is no colorbar, but it is clear that the redim did not have an effect, since the colormap is saturated.

rabernat commented 7 years ago

I don't think qmesh.redim.label(x='lat', y='depth') works either.

philippjfr commented 7 years ago

I don't think qmesh.redim.label(x='lat', y='depth') works either.

Are you sure? Seems to work for me. Do note that redim (like most other operations in holoviews) is not an inplace operation.

rabernat commented 7 years ago

The inplace issue would also apply to my original example with redim.range, no?

However, if I rewrite it as

qmesh = hv.QuadMesh((xs, ys, zs))
print(qmesh.range('z'))
newmesh = qmesh.redim.range(z=(1,2))
print(newmesh.range('z'))

it gives the same result

philippjfr commented 7 years ago

Yes, sorry for the confusion, redim.range is not working, redim.label is. The PR above will fix the issue with redim.range.

philippjfr commented 7 years ago

PR now merged. Thanks for making me look into this, it let me standardize the range implementations a lot.

github-actions[bot] commented 2 weeks ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.