Manually modify legend

Hi,

Simple question, I’d like to know if there is a simple way to access the Legend item of a holoviews figure to modify it manually.

For example I would like to do

import holoviews as hv

p = hv.Curve(...)
p2 = hv.Curve(...)
p.legend = [Legend(items=[LegendItem(..)]]

p + p2

Thanks

Probably through hooks

If the main reason you want access to the object is to somehow customize it before it is plotted, instead consider that it is possible to write so called hooks:

def hook(plot, element):
  # The bokeh/matplotlib figure
  plot.state

      # A dictionary of handles on plot subobjects, e.g. in matplotlib
      # artist, axis, legend and in bokeh x_range, y_range, glyph, cds etc.
      plot.handles

hv.Curve(df, 'x_col', 'y_col').opts(hooks=[hook])

Or .opts(legend_opts=...)?

Thankss !