using select
if I use plot.select(coord=1) I obtain the still the full layout with one of the 2 plot empty. I would like to extract only the subplot instead
I know I can use the dotted syntax to access to elements of a nested layout, but in this way the only deegrees of freedom are ‘label’ and ‘group’. Instead I would to like to have custom metadata to use to query the subplots
Sure, thanks for the answer and the patience !
The end goal is to extract only the subplot containing data with coord=1. So, in this case only the first subplot in the layout should be extracted (the hv.Points created with df not df2.
So the goal is to create layouts containing data columns (the coord column in this example) acting as metadata, so that you can extract / select subplots containing that metadata from the full layout.
More context
I’m trying to achieve this because I’d like to iteratively update the subplots with new data on demand, but only for few of them. For example, I could add a new set of points only for the subplots containing coord=1 as metadata, so I need to select them in a robust way. I think that ‘label’ and ‘group’ doesn’t fit in this scenario because, depending on the scenario, I could have an arbitrary number of metadata columns acting as and id to identify the particular data in the subplots. With this way of selecting the subplots I hope it will be easier updating them with new data even if I have nested structure. Important: I am new to this framework, so suggestions to how to achieve this goal are welcome !
Coming back to the question
Here instead, with plot.select(coord=1) I obtain still the full layout (both subplots) with one subplot empty (the one with coord=3 is empty) Instead I would like to obtain only this
import holoviews as hv
hv.extension("bokeh")
l = hv.Curve([0, 1, 2]) + hv.Scatter([0, 1, 2])
l[0]
Alternatively loop through?
import holoviews as hv
hv.extension("bokeh")
l = hv.Curve([0, 1, 2], label="C") + hv.Scatter([0, 1, 2], label="S")
for el in l:
if el.label == "C":
el.opts(color="red")
break
el
Hi thanks for the answer !
At the end I think I found the solution: using hv.NdLayout to create mult dim keys and then using .select to get the subplots !
Here the example refactored using dim1 and dim2 just to have an example with 2 kdims.