Slider on Bar Graph

Hi All, I am new to Holoviews and have started exploring it’s capabilities which seem to be more than the other lone plots… thus, I wanted to continue working and exploring the EDA through Holoviews. And, I am stuck -

I have a problem statement I am working on… its actually on classic Titanic Dataset… I have kdims as “Fare” column values and vdims as “Survived”… I am trying to plot a Bar graph with the help of Slider functionality that changes the length of the “Fare” bar by changing the Slider value at runtime. Although, I was able to partially achieve it however, I prefer to have a custom slider that has range between certain integer values for Bar graphs. Is it possible?

Hi @diliprajani

Welcome to the community.

Please provide something a little bit more tangible. For example

  • a small, working code example of what you have tried so far including data
  • a screenshot
  • or something else.

It will really help people on the other side, who would like to help you.

Thanks

Hi Marc,

Thank you for the greetings! Sure, here are more details -

  1. This is the code:
    hv.extension(‘bokeh’)
    ds = hv.Dataset(dataset, [‘Embarked’, ‘Fare’], [‘Survived’])
    layout = (ds.to(hv.Bars, ‘Embarked’, ‘Survived’))
    layout.opts(opts.Bars(width=250, height=300, framewise=True))

  2. Current Layout

  3. As shown in above figure, the Fare (slider value) is 7.75. The requirement is to have slider values in integers steps that is, 0 -10, 20, 30, 40 and so on, which changes the Bar graph at runtime.

Data:
Survived
Datatype: <class ‘pandas.core.series.Series’>,
Data:[0 1]

Embarked
Datatype: <class ‘pandas.core.series.Series’>,
Data:[‘S’ ‘C’ ‘Q’]

Fare
Datatype: <class ‘pandas.core.series.Series’>,
Data:[ 7.25 71.2833 7.925 53.1 8.05 8.4583 51.8625 21.075
11.1333 30.0708 16.7 26.55 31.275 7.8542 16. 29.125
13. 18. 7.225 26. 8.0292 35.5 31.3875]

Hope this is helpful

Thanks,
Dilip