mbilyanov
mbilyanov

Reputation: 2511

Is it possible to disable the zoom/pan window on a plotly.py candlestick chart?

I am creating a candlestick plot using plotly.py. I would like to have a horizontal split and place the candlestick data in the top split and some data curves in the bottom bottom split. I do not need panning and zooming and that lower section of the candlestick chart with the zoom/pan controls is getting in my way.

enter image description here

Upvotes: 13

Views: 20991

Answers (5)

Dimitri Rust
Dimitri Rust

Reputation: 21

do that ont the figure before show():

fig.update_xaxes(rangeslider_visible=False)

fig.show()

Upvotes: 2

Anton
Anton

Reputation: 161

It is possible to disable individual buttons from the bar.

See the Plotly Python documentation on the configuration object: https://plotly.com/python/configuration-options/#removing-modebar-buttons

example code:
fig.show(config={ 'modeBarButtonsToRemove': ['zoom', 'pan'] })

Upvotes: 1

J_Scholz
J_Scholz

Reputation: 506

To disable zoom and panning you need to set: layout.xaxis.fixedrange = true and layout.yaxis.fixedrange = true.

To hide the controls you need to set displayModeBar = false.

In Python this would for example look like this:

dcc.Graph(
    id='my-id',
    config={'displayModeBar': False},
   'layout': go.Layout(
       xaxis={'title': 'x-axis','fixedrange':True},
       yaxis={'title': 'y-axis','fixedrange':True})
)

Upvotes: 23

Tires
Tires

Reputation: 1602

I disabled it with layout.xaxis.rangeslider.visible = false

Upvotes: 3

Simeon Ikudabo
Simeon Ikudabo

Reputation: 2190

If you save the file using the control save method, I think that it disables the zoom/pan function. Around October, I had a similar issue, and when I simply saved the chart, the zoom/pan function went away. Let me know if that works.

Upvotes: 0

Related Questions