List all the values of provided key dim

Is there a more convenient way/built-in method of getting all the values of an input key dimension so I can dynamically select values using .select()

import numpy as np
import holoviews as hv
hv.extension('bokeh')

frequencies = [0.5, 0.75, 1.0, 1.25]

def sine_curve(phase, freq):
    xvals = [0.1* i for i in range(100)]
    return hv.Curve((xvals, [np.sin(phase+freq*x) for x in xvals]))

curve_dict_2D = {(p,f):sine_curve(p,f) for p in [0, np.pi/2] for f in [0.5, 0.75]}
NdLayout = hv.NdLayout(curve_dict_2D, kdims=['phase', 'frequency'])

index = NdLayout.kdims.index('phase')
phases = list(zip(*NdLayout.keys()))[index]

for phase in phases:
    NdLayout.select(phase=phases)

print(NdLayout.kdims)
print(NdLayout.keys())
print(index)
print(phases)

Output:

[Dimension('phase'), Dimension('frequency')]
[(0, 0.5), (0, 0.75), (1.5707963267948966, 0.5), (1.5707963267948966, 0.75)]
0
(0, 0, 1.5707963267948966, 1.5707963267948966)

Oh figured it out
plot.dimension_values('phase')

1 Like