I have created an interactive plot with widgets using the hvPlot .interactive() function.
The dataframe df_csv_concat
looks like:
regions 1982-1983 2008-2009 2010-2011 2019-2020 2020-2021 2021-2022 2022-2023 RAIN_PERCENTILE_25 RAIN_PERCENTILE_50 RAIN_PERCENTILE_75 RAIN_MEAN RAIN_MEDIAN Month-Day-3
0 Northern Country 0 5 0 0 0 1 0.0611691030 0 0 1 1 0 1900-07-01
1 Northern Country 0 5 0 0 1 2 0.0945720200 0 0 4 2 1 1900-07-02
2 Northern Country 0 5 1 0 1 4 0.1001043840 0 1 5 3 1 1900-07-03
3 Northern Country 0 5 1 0 6 6 0.1138830900 0 3 7 5 3 1900-07-04
... ... ... ...
# Make dataframe an interactive object
idf = df_csv_concat.interactive()
# Set up a Panel widget
regions = pn.widgets.Select(options=list(np.unique(df_csv_concat.regions)))
# Set up a dataframe pipeline
ipipeline = (
idf[
idf.regions == regions
][['Month-Day-3','regions'] + highlighted_years]
)
# Plot
ihvplot = ipipeline.hvplot.line(x='Month-Day-3', y=highlighted_years,
xlabel='Month', ylabel='Cumulative Rainfall (mm)',
xformatter=tickfmt, tools=[hover], ylim=(0,_MAX_RAINFALL),
line_width=2, height=400, width=700, grid=True, line_color='blue', line_alpha=0.8,
hover_line_color='red',
xticks=DatetimeTicker(desired_num_ticks=12), legend=False)
# Save interactive output into a HTML page. This is where the error was raised.
hvplot.save(ihvplot, 'ihvplot_all.html')
I received an error:
ValueError: HoloViews pane does not support objects of type 'Interactive'.
Is it possible to export the interactive plot generated from the pipeline output into a HTML page?