Vertical slider with plotly python

HI,

How can I achieve a vertical slider in plotly-python?

Also, with the horizontal slider: yanchor does not move it above or below the plot but it moves it within the bottom of the plot. What am I doing wrong or not doing?

This is the code:

lenfigdatasintetic=np.arange(0,110)
    steps = []
    for i in lenfigdatasintetic:
        step = dict(
            method="update",
            args=[{"zmax":i/100}] 
        )
        steps.append(step)

    sliders = [dict(
        active=110,
        currentvalue={"prefix": "higher value"},
        pad={"t": 1.3},
        steps=steps,
        yanchor="middle"
    )]

Thanks a lot!

2 Likes

If I understand correctly you are looking for a slider for the y-axis, right? For the x-axis this is easily easily possible with rangeslider, see for example Rangeslider buttons for numerical not date data.

However, I don’t know if there is an equivalent for the y-axis? I would also like to know this, so add me to the list, please.

As a workaround, it could perhaps help to make the figure zoomable using the mouse scroll wheel, see https://plotly.com/python/configuration-options/#enabling-scroll-zoom

Hi Windrose, thank you for your help!

I tried to simplify the issue and got my question inaccurate.

I am plotting a heatmap. I am trying to manipulate the scale (zmin and zmax) with a slider. It works with the slider that I show in the snippet but I would like that slider to be vertical or even better, if I could take your idea of the rangeslider in the yaxis but updating the z data… Do you think that this is possible?

Thank you again!

I am sorry, but I am new to this too and not familiar with heat maps. Probably you know that you can specify the range on the y-axis also via fig.update_yaxes(range=[0, 10]) for example, however, that may not be what you are looking for?

1 Like