Thanks for the quick reply! I think I am starting to understand it. However, I still can’t get it working. Maybe a little bit of more background information might help:
I created a ColumnDataSource
from a pandas data frame:
source = ColumnDataSource(df[['name', 'count', 'type']])
Then, I create the plot p
:
p = figure(y_range=FactorRange(factors=name, bounds=(0, len(name))))
p.hbar(y='name', left=0, right='count', height=0.9, legend='type', source=source)
and add the legend
p.legend.title = 'Type'
p.legend.location = 'bottom_right'
When I look into the legend items, I don’t get a list of legend items. In its place, I get a list of length 1:
p.legend[0].items
[LegendItem(id='16472', ...)]
Furthermore, if I look at its label, I get
p.legend[0].items[0].label
{'field': 'type'}
What should I do different to actually get a list of LegendItems?