Fred Dujardin
Fred Dujardin

Reputation: 273

hvPlot - add arguments to hook function

I am trying to find a way to get a generalized hook function to customize hvPlots but with some flexibility. Basically, I would like to be able to add some parameters to the hook function

def my_hook(plot, element):
    f = plot.state
    color= '#A50021'
    f.xaxis.axis_line_color = color

data = {'x': [1, 2, 3, 4, 5], 'y': [2, 4, 6, 8, 10]}
df = pd.DataFrame(data)

df.hvplot.line().opts(hooks=[my_hook])

I would like, for example, to be able to pass 'color' as an argument for the 'my_hook' function instead of having to rewrite a new function for each color. Is there any way to do that ?

Upvotes: 0

Views: 24

Answers (0)

Related Questions