Skip to content

Commit 31034e3

Browse files
committed
Update 3d-axes.md
1 parent 3fe31cf commit 31034e3

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

doc/python/3d-axes.md

Lines changed: 38 additions & 5 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.1'
9-
jupytext_version: 1.1.1
8+
format_version: '1.3'
9+
jupytext_version: 1.14.7
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.3
23+
version: 3.10.4
2424
plotly:
2525
description: How to format axes of 3d plots in Python with Plotly.
2626
display_as: 3d_charts
@@ -41,6 +41,8 @@ set the range, title, ticks, color etc. of the axes.
4141

4242
For creating 3D charts, see [this page](https://plotly.com/python/3d-charts/).
4343

44+
Set `range` on an axis to manually configure a range for an axis. If you don't set `range`, it's automatically calculated. In this example, we set a `range` on `xaxis`, `yaxis`, and `zaxis`.
45+
4446
```python
4547
import plotly.graph_objects as go
4648
import numpy as np
@@ -66,6 +68,37 @@ fig.update_layout(
6668
fig.show()
6769
```
6870

71+
### Setting only a Lower or Upper Bound for Range
72+
73+
*New in 5.16*
74+
75+
You can also set just a lower or upper bound for `range`. In this case, autorange is used for the other bound. In this example, we apply autorange to the lower bound of the `yaxis` and the upper bound of `zaxis` by setting them to `None`.
76+
77+
```python
78+
import plotly.graph_objects as go
79+
import numpy as np
80+
np.random.seed(1)
81+
82+
N = 70
83+
84+
fig = go.Figure(data=[go.Mesh3d(x=(70*np.random.randn(N)),
85+
y=(55*np.random.randn(N)),
86+
z=(40*np.random.randn(N)),
87+
opacity=0.5,
88+
color='rgba(244,22,100,0.6)'
89+
)])
90+
91+
fig.update_layout(
92+
scene = dict(
93+
xaxis = dict(nticks=4, range=[-100,100],),
94+
yaxis = dict(nticks=4, range=[None, 100],),
95+
zaxis = dict(nticks=4, range=[-100, None],),),
96+
width=700,
97+
margin=dict(r=20, l=10, b=10, t=10))
98+
99+
fig.show()
100+
```
101+
69102
### Fixed Ratio Axes
70103

71104
```python
@@ -229,4 +262,4 @@ fig.show()
229262

230263
```python
231264

232-
```
265+
```

0 commit comments

Comments
 (0)