Skip to content

Commit 5d7fc87

Browse files
committed
some inlining + v4upgrade tag
1 parent 19286c7 commit 5d7fc87

File tree

4 files changed

+32
-22
lines changed

4 files changed

+32
-22
lines changed

notebooks/3d-axes.md

+26-22
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jupyter:
3434
permalink: python/3d-axes/
3535
thumbnail: thumbnail/your-tutorial-chart.jpg
3636
title: Format 3d Axes | plotly
37+
v4upgrade: true
3738
---
3839

3940
### Range of axes
@@ -47,21 +48,21 @@ import plotly.graph_objs as go
4748
import numpy as np
4849

4950
N = 70
50-
trace1 = go.Mesh3d(x=(70*np.random.randn(N)),
51+
52+
fig = go.Figure(data=[go.Mesh3d(x=(70*np.random.randn(N)),
5153
y=(55*np.random.randn(N)),
5254
z=(40*np.random.randn(N)),
5355
opacity=0.5,
5456
color='rgba(244,22,100,0.6)'
55-
)
57+
)])
5658

57-
layout = go.Layout(scene = dict(
59+
fig.update(layout=go.Layout(scene = dict(
5860
xaxis = dict(nticks=4, range=[-100,100],),
5961
yaxis = dict(nticks=4, range=[-50,100],),
6062
zaxis = dict(nticks=4, range=[-100,100],),),
6163
width=700,
62-
margin=dict(r=20, l=10, b=10, t=10))
64+
margin=dict(r=20, l=10, b=10, t=10)))
6365

64-
fig = go.Figure(data=[trace1], layout=layout)
6566
fig.show()
6667
```
6768

@@ -110,27 +111,27 @@ import numpy as np
110111

111112
# Define random surface
112113
N = 50
113-
trace1 = go.Mesh3d(x=(60*np.random.randn(N)),
114+
fig = go.Figure()
115+
fig.add_trace(go.Mesh3d(x=(60*np.random.randn(N)),
114116
y=(25*np.random.randn(N)),
115117
z=(40*np.random.randn(N)),
116118
opacity=0.5,
117119
color='yellow'
118-
)
119-
trace2 = go.Mesh3d(x=(70*np.random.randn(N)),
120+
))
121+
fig.add_trace(go.Mesh3d(x=(70*np.random.randn(N)),
120122
y=(55*np.random.randn(N)),
121123
z=(30*np.random.randn(N)),
122124
opacity=0.5,
123125
color='pink'
124-
)
126+
))
125127

126-
layout = go.Layout(scene = dict(
128+
fig.update(layout=go.Layout(scene = dict(
127129
xaxis_title='X AXIS TITLE',
128130
yaxis_title='Y AXIS TITLE',
129131
zaxis_title='Z AXIS TITLE'),
130132
width=700,
131-
margin=dict(r=20, b=10, l=10, t=10))
133+
margin=dict(r=20, b=10, l=10, t=10)))
132134

133-
fig = go.Figure(data=[trace1,trace2], layout=layout)
134135
fig.show()
135136
```
136137

@@ -142,15 +143,15 @@ import numpy as np
142143

143144
# Define random surface
144145
N = 50
145-
trace1 = go.Mesh3d(x=(60*np.random.randn(N)),
146+
fig = go.Figure(data=[go.Mesh3d(x=(60*np.random.randn(N)),
146147
y=(25*np.random.randn(N)),
147148
z=(40*np.random.randn(N)),
148149
opacity=0.5,
149150
color='rgba(100,22,200,0.5)'
150-
)
151+
)])
151152

152153
# Different types of customized ticks
153-
layout = go.Layout(
154+
fig.update(layout=go.Layout(
154155
scene = dict(
155156
xaxis = dict(
156157
ticktext= ['TICKS','MESH','PLOTLY','PYTHON'],
@@ -166,8 +167,8 @@ layout = go.Layout(
166167
tick0=0, tickwidth=4),),
167168
width=700,
168169
margin=dict(r=10, l=10, b=10, t=10)
169-
)
170-
fig = go.Figure(data=[trace1], layout=layout)
170+
))
171+
171172
fig.show()
172173
```
173174

@@ -178,14 +179,14 @@ import plotly.graph_objs as go
178179
import numpy as np
179180

180181
N = 50
181-
trace1 = go.Mesh3d(x=(30*np.random.randn(N)),
182+
fig = go.Figure(data=[go.Mesh3d(x=(30*np.random.randn(N)),
182183
y=(25*np.random.randn(N)),
183184
z=(30*np.random.randn(N)),
184-
opacity=0.5,)
185+
opacity=0.5,)])
185186

186187

187188
# xaxis.backgroundcolor is used to set background color
188-
layout = go.Layout(
189+
fig.update(layout = go.Layout(
189190
scene = dict(
190191
xaxis = dict(
191192
backgroundcolor="rgb(200, 200, 230)",
@@ -206,7 +207,10 @@ layout = go.Layout(
206207
margin=dict(
207208
r=10, l=10,
208209
b=10, t=10)
209-
)
210-
fig = go.Figure(data=[trace1], layout=layout)
210+
))
211211
fig.show()
212212
```
213+
214+
```python
215+
216+
```

notebooks/3d-mesh.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
jupyter:
33
jupytext:
4+
notebook_metadata_filter: all
45
text_representation:
56
extension: .md
67
format_name: markdown
@@ -23,6 +24,7 @@ jupyter:
2324
permalink: python/3d-mesh/
2425
thumbnail: thumbnail/3d-mesh.jpg
2526
title: 3D Mesh Plots in Python | plotly
27+
v4upgrade: true
2628
---
2729

2830
### Simple 3D Mesh example ###

notebooks/3d-scatter-plots.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
jupyter:
33
jupytext:
4+
notebook_metadata_filter: all
45
text_representation:
56
extension: .md
67
format_name: markdown
@@ -23,6 +24,7 @@ jupyter:
2324
permalink: python/3d-scatter-plots/
2425
thumbnail: thumbnail/3d-scatter.jpg
2526
title: 3D Python Scatter Plots | plotly
27+
v4upgrade: true
2628
---
2729

2830
#### Basic 3D Scatter Plot

notebooks/3d-surface-plots.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
jupyter:
33
jupytext:
4+
notebook_metadata_filter: all
45
text_representation:
56
extension: .md
67
format_name: markdown
@@ -23,6 +24,7 @@ jupyter:
2324
permalink: python/3d-surface-plots/
2425
thumbnail: thumbnail/3d-surface.jpg
2526
title: 3D Surface Plots in Python | Plotly
27+
v4upgrade: true
2628
---
2729

2830
#### Topographical 3D Surface Plot

0 commit comments

Comments
 (0)