Skip to content

Commit dbf9d87

Browse files
authored
Merge pull request #4793 from plotly/remove-deprecated-attributes
Remove deprecated attributes from docs
2 parents 9ce66e6 + 827d9dc commit dbf9d87

12 files changed

+190
-78
lines changed

Diff for: doc/python/3d-bubble-charts.md

+70-17
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.2.3
8+
format_version: '1.3'
9+
jupytext_version: 1.16.4
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.11.10
2424
plotly:
2525
description: How to make 3D Bubble Charts in Python with Plotly. Three examples
2626
of 3D Bubble Charts.
@@ -113,12 +113,39 @@ fig = go.Figure(data=go.Scatter3d(
113113
)
114114
))
115115

116-
fig.update_layout(width=800, height=800, title = 'Planets!',
117-
scene = dict(xaxis=dict(title='Distance from Sun', titlefont_color='white'),
118-
yaxis=dict(title='Density', titlefont_color='white'),
119-
zaxis=dict(title='Gravity', titlefont_color='white'),
120-
bgcolor = 'rgb(20, 24, 54)'
121-
))
116+
fig.update_layout(
117+
width=800,
118+
height=800,
119+
title="Planets!",
120+
scene=dict(
121+
xaxis=dict(
122+
title=dict(
123+
text="Distance from Sun",
124+
font=dict(
125+
color="white"
126+
)
127+
)
128+
),
129+
yaxis=dict(
130+
title=dict(
131+
text="Density",
132+
font=dict(
133+
color="white"
134+
)
135+
)
136+
),
137+
zaxis=dict(
138+
title=dict(
139+
text="Gravity",
140+
font=dict(
141+
color="white"
142+
)
143+
)
144+
),
145+
bgcolor="rgb(20, 24, 54)"
146+
)
147+
)
148+
122149

123150
fig.show()
124151
```
@@ -154,16 +181,42 @@ fig = go.Figure(go.Scatter3d(
154181
)
155182
))
156183

157-
fig.update_layout(width=800, height=800, title = 'Planets!',
158-
scene = dict(xaxis=dict(title='Distance from Sun', titlefont_color='white'),
159-
yaxis=dict(title='Density', titlefont_color='white'),
160-
zaxis=dict(title='Gravity', titlefont_color='white'),
161-
bgcolor = 'rgb(20, 24, 54)'
162-
))
184+
fig.update_layout(
185+
width=800,
186+
height=800,
187+
title="Planets!",
188+
scene=dict(
189+
xaxis=dict(
190+
title=dict(
191+
text="Distance from Sun",
192+
font=dict(
193+
color="white"
194+
)
195+
)
196+
),
197+
yaxis=dict(
198+
title=dict(
199+
text="Density",
200+
font=dict(
201+
color="white"
202+
)
203+
)
204+
),
205+
zaxis=dict(
206+
title=dict(
207+
text="Gravity",
208+
font=dict(
209+
color="white"
210+
)
211+
)
212+
),
213+
bgcolor="rgb(20, 24, 54)"
214+
)
215+
)
163216

164217
fig.show()
165218
```
166219

167220
#### Reference
168221

169-
See https://plotly.com/python/reference/scatter3d/ and https://plotly.com/python/reference/scatter/#scatter-marker-sizeref <br>for more information and chart attribute options!
222+
See https://plotly.com/python/reference/scatter3d/ and https://plotly.com/python/reference/scatter/#scatter-marker-sizeref <br>for more information and chart attribute options!

Diff for: doc/python/bar-charts.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jupyter:
3737

3838
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on a variety of types of data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
3939

40-
With `px.bar`, **each row of the DataFrame is represented as a rectangular mark**. To aggregate multiple data points into the same rectangular mark, please refer to the [histogram documentation](/python/histograms).
40+
With `px.bar`, **each row of the DataFrame is represented as a rectangular mark**. To aggregate multiple data points into the same rectangular mark, please refer to the [histogram documentation](/python/histograms).
4141

4242
In the example below, there is only a single row of data per year, so a single bar is displayed per year.
4343

@@ -152,7 +152,7 @@ fig.show()
152152

153153
### Aggregating into Single Colored Bars
154154

155-
As noted above `px.bar()` will result in **one rectangle drawn per row of input**. This can sometimes result in a striped look as in the examples above. To combine these rectangles into one per color per position, you can use `px.histogram()`, which has [its own detailed documentation page](/python/histogram).
155+
As noted above `px.bar()` will result in **one rectangle drawn per row of input**. This can sometimes result in a striped look as in the examples above. To combine these rectangles into one per color per position, you can use `px.histogram()`, which has [its own detailed documentation page](/python/histogram).
156156

157157
> `px.bar` and `px.histogram` are designed to be nearly interchangeable in their call signatures, so as to be able to switch between aggregated and disaggregated bar representations.
158158
@@ -304,7 +304,7 @@ fig.update_layout(barmode='stack')
304304
fig.show()
305305
```
306306

307-
### Stacked Bar Chart From Aggregating a DataFrame
307+
### Stacked Bar Chart From Aggregating a DataFrame
308308

309309
Stacked bar charts are a powerful way to present results summarizing categories generated using the Pandas aggregate commands. `pandas.DataFrame.agg` produces a wide data set format incompatible with `px.bar`. Transposing and updating the indexes to achieve `px.bar` compatibility is a somewhat involved option. Here is one straightforward alternative, which presents the aggregated data as a stacked bar using plotly.graph_objects.
310310

@@ -326,19 +326,19 @@ df_summarized["percent of world population"]=100*df_summarized["pop"]/df_summari
326326
df_summarized["percent of world GDP"]=100*df_summarized["gdp"]/df_summarized["gdp"].sum()
327327

328328

329-
df = df_summarized[["continent",
329+
df = df_summarized[["continent",
330330
"percent of world population",
331331
"percent of world GDP",
332332
]]
333333

334334
# We now have a wide data frame, but it's in the opposite orientation from the one that px is designed to deal with.
335-
# Transposing it and rebuilding the indexes is an option, but iterating through the DF using graph objects is more succinct.
335+
# Transposing it and rebuilding the indexes is an option, but iterating through the DF using graph objects is more succinct.
336336

337337
fig=go.Figure()
338338
for category in df_summarized["continent"].values:
339339
fig.add_trace(go.Bar(
340340
x=df.columns[1:],
341-
# We need to get a pandas series that contains just the values to graph;
341+
# We need to get a pandas series that contains just the values to graph;
342342
# We do so by selecting the right row, selecting the right columns
343343
# and then transposing and using iloc to convert to a series
344344
# Here, we assume that the bar element category variable is in column 0
@@ -619,8 +619,12 @@ fig.update_layout(
619619
title='US Export of Plastic Scrap',
620620
xaxis_tickfont_size=14,
621621
yaxis=dict(
622-
title='USD (millions)',
623-
titlefont_size=16,
622+
title=dict(
623+
text="USD (millions)",
624+
font=dict(
625+
size=16
626+
)
627+
),
624628
tickfont_size=14,
625629
),
626630
legend=dict(

Diff for: doc/python/carpet-contour.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,10 @@ fig.add_trace(go.Contourcarpet(
159159
colorbar = dict(
160160
y = 0,
161161
yanchor = "bottom",
162-
titleside = "right",
163162
len = 0.75,
164-
title = "Pressure coefficient, c<sub>p</sub>"
163+
title = dict(
164+
text="Pressure coefficient, c<sub>p</sub>",
165+
side="right")
165166
),
166167
contours = dict(
167168
start = -1,

Diff for: doc/python/colorscales.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,10 @@ fig = go.Figure()
321321
fig.add_trace(go.Heatmap(
322322
z=dataset["z"],
323323
colorbar=dict(
324-
title="Surface Heat",
325-
titleside="top",
324+
title=dict(
325+
text="Surface Heat",
326+
side="top",
327+
),
326328
tickmode="array",
327329
tickvals=[2, 25, 50, 75, 100],
328330
labelalias={100: "Hot", 50: "Mild", 2: "Cold"},
@@ -545,8 +547,10 @@ fig = go.Figure()
545547
fig.add_trace(go.Heatmap(
546548
z=dataset["z"],
547549
colorbar=dict(
548-
title="Surface Heat",
549-
titleside="top",
550+
title=dict(
551+
text="Surface Heat",
552+
side="top",
553+
),
550554
tickmode="array",
551555
tickvals=[2, 50, 100],
552556
ticktext=["Cool", "Mild", "Hot"],

Diff for: doc/python/contour-plots.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,15 @@ fig = go.Figure(data=
281281
[0.625, 1.25, 3.125, 6.25, 10.625],
282282
[0, 0.625, 2.5, 5.625, 10]],
283283
colorbar=dict(
284-
title='Color bar title', # title here
285-
titleside='right',
286-
titlefont=dict(
287-
size=14,
288-
family='Arial, sans-serif')
289-
)))
284+
title=dict(
285+
text='Color bar title', # title here
286+
side='right',
287+
font=dict(
288+
size=14,
289+
family='Arial, sans-serif')
290+
)
291+
),
292+
))
290293

291294
fig.show()
292295
```

Diff for: doc/python/multiple-axes.md

+20-12
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,22 @@ fig.update_layout(
192192
domain=[0.3, 0.7]
193193
),
194194
yaxis=dict(
195-
title="yaxis title",
196-
titlefont=dict(
197-
color="#1f77b4"
195+
title=dict(
196+
text="yaxis title",
197+
font=dict(
198+
color="#1f77b4"
199+
)
198200
),
199201
tickfont=dict(
200202
color="#1f77b4"
201203
)
202204
),
203205
yaxis2=dict(
204-
title="yaxis2 title",
205-
titlefont=dict(
206-
color="#ff7f0e"
206+
title=dict(
207+
text="yaxis2 title",
208+
font=dict(
209+
color="#ff7f0e"
210+
)
207211
),
208212
tickfont=dict(
209213
color="#ff7f0e"
@@ -214,9 +218,11 @@ fig.update_layout(
214218
position=0.15
215219
),
216220
yaxis3=dict(
217-
title="yaxis3 title",
218-
titlefont=dict(
219-
color="#d62728"
221+
title=dict(
222+
text="yaxis3 title",
223+
font=dict(
224+
color="#d62728"
225+
)
220226
),
221227
tickfont=dict(
222228
color="#d62728"
@@ -226,9 +232,11 @@ fig.update_layout(
226232
side="right"
227233
),
228234
yaxis4=dict(
229-
title="yaxis4 title",
230-
titlefont=dict(
231-
color="#9467bd"
235+
title=dict(
236+
text="yaxis4 title",
237+
font=dict(
238+
color="#9467bd"
239+
)
232240
),
233241
tickfont=dict(
234242
color="#9467bd"

Diff for: doc/python/network-graphs.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@ node_trace = go.Scatter(
9898
size=10,
9999
colorbar=dict(
100100
thickness=15,
101-
title='Node Connections',
101+
title=dict(
102+
text='Node Connections',
103+
side='right'
104+
),
102105
xanchor='left',
103-
titleside='right'
104106
),
105107
line_width=2))
106108

@@ -128,8 +130,12 @@ node_trace.text = node_text
128130
```python
129131
fig = go.Figure(data=[edge_trace, node_trace],
130132
layout=go.Layout(
131-
title='<br>Network graph made with Python',
132-
titlefont_size=16,
133+
title=dict(
134+
text="<br>Network graph made with Python",
135+
font=dict(
136+
size=16
137+
)
138+
),
133139
showlegend=False,
134140
hovermode='closest',
135141
margin=dict(b=20,l=5,r=5,t=40),

0 commit comments

Comments
 (0)