-
-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support grabbing the label (and group?) for each subcoordinate_y
plot from the NdOverlay key
#6028
Comments
subcoordinate_y
plot from the NdOverlay keysubcoordinate_y
plot from the NdOverlay key. Also reverse layering
Just checking which of my issues are still valid. This is still a valid issue. |
I'm closing this.. I am no longer convinced that this is obvious behavior.. For instance.. what if the key in the dict conflicts with a provided label? I don't think it's that much more work to just set the label per element |
I do think this is important, often you will create this view by grouping a dataset by some dimension and those operations will produce an NdOverlay with the values along that dimension (e.g. channels). Adding labels would be pretty cumbersome. |
subcoordinate_y
plot from the NdOverlay key. Also reverse layeringsubcoordinate_y
plot from the NdOverlay key
I'm trying to think through the implementation of this a bit more. My interpretation of what you mean by 'grouping a dataset by some dimension' is something like calling Here is one possible simplified implementation, which of course doesn't yet work with subcoordinate_y because we cannot yet implicitly set the label are per curve. import numpy as np
import holoviews as hv
import xarray as xr
hv.extension('bokeh')
n_channels = 10
n_seconds = 5
total_samples = 256*n_seconds
time = np.linspace(0, n_seconds, total_samples)
data = np.random.randn(n_channels, total_samples).cumsum(axis=1)
channels = [f"EEG {i}" for i in range(n_channels)]
data_xr = xr.DataArray(data, dims=['channel', 'time'], coords={'channel': channels, 'time': time}, name='value')
curves = hv.Dataset(data_xr).to(hv.Curve, 'time', 'value', 'channel').overlay('channel').opts(
hv.opts.Curve(
tools=['hover'],
# subcoordinate_y=True # Currently requires a unique label per item
),
hv.opts.NdOverlay(
responsive=True,
aspect=3,
)
)
curves I guess in this case, the fix would be for NdOverlay to grab the channel value as the label. But then if we are trying to avoid for loops entirely, what would be a good approach to setting the I tried the following but HoloViews doesn't support such complexity: import numpy as np
import xarray as xr
import holoviews as hv
hv.extension('bokeh')
n_channels = 10
n_seconds = 5
total_samples = 256 * n_seconds
groups = ['A', 'B', 'C']
time = np.linspace(0, n_seconds, total_samples)
data = np.random.randn(n_channels, total_samples).cumsum(axis=1)
channels = [f"EEG {i}" for i in range(n_channels)]
channel_groups = [groups[i % len(groups)] for i in range(n_channels)]
data_xr = xr.DataArray(
data,
dims=['channel', 'time'],
coords={
'channel': channels,
'time': time,
'group': ('channel', channel_groups)
},
name='value'
)
curves = hv.Dataset(data_xr).to(hv.Curve, 'time', 'value', ['channel', 'group']).overlay('channel').opts(
hv.opts.Curve(
tools=['hover'],
),
hv.opts.NdOverlay(
responsive=True,
aspect=3,
)
)
curves It would be really useful to see (at least pseudocode) of what you think would be a good API |
subcoordinate_y
plot from the NdOverlay keysubcoordinate_y
plot from the NdOverlay key
As @philippjfr described here, HoloViews should support grabbing the label for each subcoordinate_y plot from the NdOverlay key.
so something like this should just work:
And produced something like this
The text was updated successfully, but these errors were encountered: