Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d9ec816

Browse files
Add modebar button disable example
1 parent 72fb5cd commit d9ec816

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

‎doc/python/configuration-options.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
9-
jupytext_version: 1.4.2
8+
format_version: '1.3'
9+
jupytext_version: 1.17.2
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.7
23+
version: 3.12.4
2424
plotly:
2525
description: How to set the configuration options of figures using the Plotly
2626
Python graphing library.
@@ -323,6 +323,42 @@ fig.update_layout(xaxis={'type': 'date'})
323323
fig.show(config=config)
324324
```
325325

326+
### Disabling Buttons for Specific Axes
327+
328+
*New in 6.3*
329+
330+
Disabling the zoom in, zoom out, and autoscale buttons for specific axes is supported on cartesian axes using the `modebardisable` attribute. In the following example, the zoom in and zoom out buttons are disabled on the `xaxis`, meaning these buttons only zoom in and out on the `yaxis`. Disable the autoscale button using `modebardisable='autoscale'`. You can also disable both autoscaling and zoom buttons using `modebardisable='zoominout+autoscale'`.
331+
332+
```python
333+
import plotly.graph_objects as go
334+
import plotly.data
335+
336+
df = plotly.data.stocks()
337+
338+
fig = go.Figure(
339+
data=[
340+
go.Scatter(
341+
x=df['date'],
342+
y=df['GOOG'],
343+
mode='lines+markers',
344+
name='Google Stock Price'
345+
)
346+
],
347+
layout=go.Layout(
348+
title='Google Stock Price Over Time with Mode Bar Disabled',
349+
xaxis=dict(
350+
title='Date',
351+
# Try zooming in or out using the modebar buttons. These only apply to the yaxis in this exampe.
352+
modebardisable='zoominout'
353+
),
354+
yaxis=dict(
355+
title='Stock Price (USD)',
356+
)
357+
)
358+
)
359+
fig.show()
360+
```
361+
326362
### Configuring Figures in Dash Apps
327363

328364
The same configuration dictionary that you pass to the `config` parameter of the `show()` method can also be passed to the [`config` property of a `dcc.Graph` component](https://dash.plotly.com/dash-core-components/graph).

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /