Skip to content

Commit a022a20

Browse files
fixedrange
1 parent 6bd39ba commit a022a20

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

doc/python/axes.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,20 @@ fig.update_yaxes(range=[3, 9])
531531
fig.show()
532532
```
533533

534+
#### Disabling Pan/Zoom on Axes (Fixed Range)
535+
536+
Pan/Zoom can be disabled for a given axis by setting `fixedrange` to `True`.
537+
538+
```python
539+
import plotly.express as px
540+
df = px.data.iris()
541+
542+
fig = px.scatter(df, x="sepal_width", y="sepal_length", facet_col="species")
543+
fig.update_xaxes(fixedrange=True)
544+
545+
fig.show()
546+
```
547+
534548
### Fixed Ratio Axes
535549

536550
The `scaleanchor` and `scaleratio` axis properties can be used to force a fixed ratio of pixels per unit between two axes.
@@ -742,7 +756,7 @@ fig.show()
742756

743757
#### Synchronizing axes in subplots with `matches`
744758

745-
Using `facet_col` from `plotly.express` let [zoom](https://help.plotly.com/zoom-pan-hover-controls/#step-3-zoom-in-and-zoom-out-autoscale-the-plot) and [pan](https://help.plotly.com/zoom-pan-hover-controls/#step-6-pan-along-axes) each facet to the same range implicitly. However, if the subplots are created with `make_subplots`, the axis needs to be updated with `matches` parameter to update all the subplots accordingly.
759+
Using `facet_col` from `plotly.express` let [zoom](https://help.plotly.com/zoom-pan-hover-controls/#step-3-zoom-in-and-zoom-out-autoscale-the-plot) and [pan](https://help.plotly.com/zoom-pan-hover-controls/#step-6-pan-along-axes) each facet to the same range implicitly. However, if the subplots are created with `make_subplots`, the axis needs to be updated with `matches` parameter to update all the subplots accordingly.
746760

747761
Zoom in one trace below, to see the other subplots zoomed to the same x-axis range. To pan all the subplots, click and drag from the center of x-axis to the side:
748762

@@ -763,4 +777,4 @@ fig.show()
763777

764778
#### Reference
765779

766-
See https://plotly.com/python/reference/#layout-xaxis and https://plotly.com/python/reference/#layout-yaxis for more information and chart attribute options!
780+
See https://plotly.com/python/reference/#layout-xaxis and https://plotly.com/python/reference/#layout-yaxis for more information and chart attribute options!

0 commit comments

Comments
 (0)