Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

plotly

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

like image 699
mbilyanov Avatar asked Jan 03 '18 17:01

mbilyanov


People also ask

How do you remove gridlines in Plotly?

How do you remove gridlines in Plotly? Toggling Axis grid lines Axis grid lines can be disabled by setting the showgrid property to False for the x and/or y axis. Here is an example of setting showgrid to False in the graph object figure constructor.

How do I hide the Plotly toolbar in Python?

To disable this floating toolbar, we can pass a single config parameter to the plot function. We use the predefined config object in Plotly. And we just need to set displayModeBar to false in the config object. This parameter passed in dictionary format will hide the floating toolbar once and for all.

What does Add_trace do in Plotly?

Adding Traces New traces can be added to a plot_ly figure using the add_trace() method. This method accepts a plot_ly figure trace and adds it to the figure. This allows you to start with an empty figure, and add traces to it sequentially.

What is Plotly Graph_objs?

The plotly.graph_objs module is the most important module that contains all of the class definitions for the objects that make up the plots you see.


2 Answers

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})
)
like image 76
J_Scholz Avatar answered Oct 17 '22 21:10

J_Scholz


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

like image 28
Tires Avatar answered Oct 17 '22 23:10

Tires