Search code examples
pythonjupyter-notebookplotly

Range slider for plotly waterfall in python


I would like to implement a range slider for plotly.graph_objects.Waterfall chart. Unfortunately its layout has no property rangeslider so passing rangeslider=dict(visible=True) in fig.update_layout won't work. However, there seems to be a sliders property but plotly sliders seem to not support ranges and do not display a miniature graph.

Currently I have a waterfall_ax chart in my Jupyter notebook with a ipywidgets IntRangeSlider which is working fine ecxept for it beeing to short for conveniently selecting the values and also placed on the top left of the chart. But knowing the rangeslider from plotly I was hoping to achieve a more cleaner and intuitive interface and chart.

Is there a way to get something similar to the plotly range slider for waterfall charts?


Solution

  • The rangeslider belongs to the xaxis in the layout :

    fig.update_layout(xaxis_rangeslider_visible=True)
    

    Note the above code uses magic underscore notation.