'Add data selector widget to Holoviews Python plot
I am trying to add a widget to my Holoviews plot so I can select the date of the data it is showing.
I have a Pandas dataframe that looks like this:
| Column 1 | Column 2 | |
|---|---|---|
| timestamp | ||
| 2022-03-18 16:33:19.900000+00:00 | 20.4 | 50.2 |
| 2022-03-18 16:34:29.500000+00:00 | 34.8 | 60.4 |
And I am plotting my data using the following code:
def create_hv_dmap(self, data: DataFrame) -> DynamicMap:
BLM = data['Column 1'].to_list()
values = data['Column 2'].to_list()
list_tuples = list(zip(BLM, values))
pbars = hv.Bars(list_tuples, hv.Dimension('BLM'), '[Unit]')
pbars.opts(width=1300, xrotation=90)
pline = hv.Curve(list_tuples)
pline.opts(
color='red',
line_dash='dashed',
line_width=0.8,
)
p = pbars * pline
return p
My first idea would be to have a DateRangeSlider widget so I can directly select the ranges in which my data is shown. I have tried to do it but I couldn't manage to make it work... Another option would be to add directly a menu so I can select the week for which I want to show the data, but I couldn't manage to do that either, and I find difficult to follow the examples I found on the internet about putting widgets to Holoviews... Could someone please give me a hand with this? Thank you in advance,
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
