Reputation: 2650
so using the bare minimum code to produce a chart in plotly.py:
from plotly.offline import plot
from plotly.graph_objs import Scatter
plot([Scatter(x=[1, 2, 3, 4, 5], y=[3, 2, 1, 2, 3])])
produces a nice chart with a modebar on top of it. I would like to embed my chart in a website where the bar seems really intrusive. In plotly.js there's a really simple way to disable to modebar as shown here. The solution in plotly.js is merely giving additional parameter: Plotly.newPlot('myDiv', data, layout, {displayModeBar: false});
I know there's a way to save static image from plotly where the modebar is obviously disabled, but that would lose the interactive hover-actions on the plot itself, which are useful, whereas the bar that comes with it is not really that useful in my case. What I'm wondering is if there's a way to do remove the modebar in a similiar fashion to how plotly.js works?
One solution, I suppose would be to always go through the produced HTML-file and add every part of the hover bar to r.modeBarButtonsToRemove, which could turn troublesome in the long run.
Upvotes: 7
Views: 9473
Reputation: 286
I am a little late here. But just a side note, this won't disable the functions of the top bar so when you hover it will still zoom and pan (which is extremely annoying on plots that are viewed from a mobile device). But making it a static plot isn't a good solution because I still want users on a computer to be able to hover over the points on the plot.
I solved this by changing two of the figure layout settings.
xaxis_fixedrange
and yaxis_fixedrange
need to be set to True
if you want to disable zooming.
Upvotes: 1
Reputation: 126
I've been able to do it using the config key word argument, like this:
graph = py.plot(
figure,
output_type='div',
auto_open=False,
show_link=False,
config=dict(
displayModeBar=False
)
)
Upvotes: 11