I am trying to make interactive dashboards from my data. I use panel. I have tha scatter hvplot below and I want to add customization, like VSpan or VLine elements. My problem is I am working with interactive objects. My problem was that these elements don't accept interactive objects as values, though I want both customizations interactive.
import pandas as pd
import numpy as np
import panel as pn
import hvplot.pandas
import holoviews as hv
test_df = pd.DataFrame({'x': ['a','b','c','d','e','f','g','h','i','j','k','l'],\
'y': [1,2,3,4,5,3,4,7,5,4,3,2], 'z': [4,5,6,3,7,5,6,4,5,6,4,3],\
'year' : [2020,2020,2021,2021,2022,2022,2023,2023,2020,2021,2022,2023]})
int_test_df = test_df.interactive()
test_year_slider = pn.widgets.IntSlider(name='Year slider', start=test_df.year.min(), end=test_df.year.max(), step=1, value=test_df.year.min())
test_xaxis_param = pn.widgets.RadioButtonGroup(
name='x axis',
options= ['y','z'],
button_type='success'
)
test_pipeline = (
int_test_df[
(int_test_df.year == test_year_slider)
]
.sort_values(by='year')
.reset_index(drop=True)
)
test_scatter = test_pipeline.hvplot(x=test_xaxis_param, y='x', kind='scatter', size=200, color ='black', legend=True,\
height=500, width=500, ylabel='', xticks=[test_pipeline[test_xaxis_param].iloc[0],3])
test_scatter
I tried overlaying a matplotlib or bokeh chart over the hvplot to set as 'background' to the hvplot but I couldn't manage. Do you have any advice?