Skip to content

Update docs examples to use title.text instead of title as a string for title #4850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions doc/python/3d-axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,22 @@ fig.add_trace(go.Mesh3d(x=(70*np.random.randn(N)),
))

fig.update_layout(scene = dict(
xaxis_title='X AXIS TITLE',
yaxis_title='Y AXIS TITLE',
zaxis_title='Z AXIS TITLE'),
xaxis=dict(
title=dict(
text='X AXIS TITLE'
)
),
yaxis=dict(
title=dict(
text='Y AXIS TITLE'
)
),
zaxis=dict(
title=dict(
text='Z AXIS TITLE'
)
),
),
width=700,
margin=dict(r=20, b=10, l=10, t=10))

Expand Down
6 changes: 3 additions & 3 deletions doc/python/3d-bubble-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fig = go.Figure(data=go.Scatter3d(


fig.update_layout(height=800, width=800,
title='Examining Population and Life Expectancy Over Time')
title=dict(text='Examining Population and Life Expectancy Over Time'))

fig.show()
```
Expand Down Expand Up @@ -116,7 +116,7 @@ fig = go.Figure(data=go.Scatter3d(
fig.update_layout(
width=800,
height=800,
title="Planets!",
title=dict(text="Planets!"),
scene=dict(
xaxis=dict(
title=dict(
Expand Down Expand Up @@ -184,7 +184,7 @@ fig = go.Figure(go.Scatter3d(
fig.update_layout(
width=800,
height=800,
title="Planets!",
title=dict(text="Planets!"),
scene=dict(
xaxis=dict(
title=dict(
Expand Down
18 changes: 9 additions & 9 deletions doc/python/3d-camera-controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title='Mt Bruno Elevation',
title=dict(text='Mt Bruno Elevation'),
width=400, height=400,
margin=dict(t=40, r=0, l=20, b=20)
)
Expand Down Expand Up @@ -85,7 +85,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title='Mt Bruno Elevation',
title=dict(text='Mt Bruno Elevation'),
width=400, height=400,
margin=dict(t=30, r=0, l=20, b=10)
)
Expand All @@ -112,7 +112,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title='Mt Bruno Elevation',
title=dict(text='Mt Bruno Elevation'),
width=400, height=400,
margin=dict(t=30, r=0, l=20, b=10)
)
Expand All @@ -138,7 +138,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title='Mt Bruno Elevation',
title=dict(text='Mt Bruno Elevation'),
width=400, height=400,
margin=dict(t=30, r=0, l=20, b=10)
)
Expand All @@ -163,7 +163,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title='Mt Bruno Elevation',
title=dict(text='Mt Bruno Elevation'),
width=400, height=400,
margin=dict(t=30, r=0, l=20, b=10)
)
Expand All @@ -189,7 +189,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title='Mt Bruno Elevation',
title=dict(text='Mt Bruno Elevation'),
width=400, height=400,
margin=dict(t=30, r=0, l=20, b=10)
)
Expand All @@ -216,7 +216,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title='Mt Bruno Elevation',
title=dict(text='Mt Bruno Elevation'),
width=400, height=400,
margin=dict(t=30, r=0, l=20, b=10)
)
Expand All @@ -243,7 +243,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title='Mt Bruno Elevation',
title=dict(text='Mt Bruno Elevation'),
width=400, height=400,
margin=dict(t=30, r=0, l=20, b=10)
)
Expand Down Expand Up @@ -273,7 +273,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
fig.update_layout(
title='Mt Bruno Elevation',
title=dict(text='Mt Bruno Elevation'),
width=400, height=400,
margin=dict(t=25, r=0, l=20, b=30)
)
Expand Down
6 changes: 3 additions & 3 deletions doc/python/3d-mesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fig = go.Figure(data=[
x=[0, 1, 2, 0],
y=[0, 0, 1, 2],
z=[0, 2, 0, 1],
colorbar_title='z',
colorbar=dict(title=dict(text='z')),
colorscale=[[0, 'gold'],
[0.5, 'mediumturquoise'],
[1, 'magenta']],
Expand Down Expand Up @@ -128,7 +128,7 @@ fig = go.Figure(data=[
x=[0, 0, 1, 1, 0, 0, 1, 1],
y=[0, 1, 1, 0, 0, 1, 1, 0],
z=[0, 0, 0, 0, 1, 1, 1, 1],
colorbar_title='z',
colorbar=dict(title=dict(text='z')),
colorscale=[[0, 'gold'],
[0.5, 'mediumturquoise'],
[1, 'magenta']],
Expand Down Expand Up @@ -160,7 +160,7 @@ fig = go.Figure(data=[
x=[0, 0, 1, 1, 0, 0, 1, 1],
y=[0, 1, 1, 0, 0, 1, 1, 0],
z=[0, 0, 0, 0, 1, 1, 1, 1],
colorbar_title='z',
colorbar=dict(title=dict(text='z')),
colorscale=[[0, 'gold'],
[0.5, 'mediumturquoise'],
[1, 'magenta']],
Expand Down
6 changes: 3 additions & 3 deletions doc/python/3d-surface-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a

fig = go.Figure(data=[go.Surface(z=z_data.values)])

fig.update_layout(title='Mt Bruno Elevation', autosize=False,
fig.update_layout(title=dict(text='Mt Bruno Elevation'), autosize=False,
width=500, height=500,
margin=dict(l=65, r=50, b=65, t=90))

Expand All @@ -67,7 +67,7 @@ z = z_data.values
sh_0, sh_1 = z.shape
x, y = np.linspace(0, 1, sh_0), np.linspace(0, 1, sh_1)
fig = go.Figure(data=[go.Surface(z=z, x=x, y=y)])
fig.update_layout(title='Mt Bruno Elevation', autosize=False,
fig.update_layout(title=dict(text='Mt Bruno Elevation'), autosize=False,
width=500, height=500,
margin=dict(l=65, r=50, b=65, t=90))
fig.show()
Expand All @@ -90,7 +90,7 @@ z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/a
fig = go.Figure(data=[go.Surface(z=z_data.values)])
fig.update_traces(contours_z=dict(show=True, usecolormap=True,
highlightcolor="limegreen", project_z=True))
fig.update_layout(title='Mt Bruno Elevation', autosize=False,
fig.update_layout(title=dict(text='Mt Bruno Elevation'), autosize=False,
scene_camera_eye=dict(x=1.87, y=0.88, z=-0.64),
width=500, height=500,
margin=dict(l=65, r=50, b=65, t=90)
Expand Down
4 changes: 2 additions & 2 deletions doc/python/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fig = go.Figure(
layout=go.Layout(
xaxis=dict(range=[0, 5], autorange=False),
yaxis=dict(range=[0, 5], autorange=False),
title="Start Title",
title=dict(text="Start Title"),
updatemenus=[dict(
type="buttons",
buttons=[dict(label="Play",
Expand Down Expand Up @@ -240,7 +240,7 @@ fig = go.Figure(
layout=go.Layout(width=600, height=600,
xaxis=dict(range=[xm, xM], autorange=False, zeroline=False),
yaxis=dict(range=[ym, yM], autorange=False, zeroline=False),
title="Moving Frenet Frame Along a Planar Curve",
title=dict(text="Moving Frenet Frame Along a Planar Curve"),
hovermode="closest",
updatemenus=[dict(type="buttons",
buttons=[dict(label="Play",
Expand Down
4 changes: 2 additions & 2 deletions doc/python/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,8 @@ import plotly.express as px
df = px.data.stocks(indexed=True)

fig = px.line(df, df.index, y="GOOG")
fig.update_yaxes(ticklabelposition="inside", title="Price")
fig.update_xaxes(insiderange=['2018-10-01', '2019-01-01'], title="Date")
fig.update_yaxes(ticklabelposition="inside", title=dict(text="Price"))
fig.update_xaxes(insiderange=['2018-10-01', '2019-01-01'], title=dict(text="Date"))

fig.show()
```
Expand Down
2 changes: 1 addition & 1 deletion doc/python/bar-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ fig.add_trace(go.Bar(x=years,
))

fig.update_layout(
title='US Export of Plastic Scrap',
title=dict(text='US Export of Plastic Scrap'),
xaxis_tickfont_size=14,
yaxis=dict(
title=dict(
Expand Down
9 changes: 6 additions & 3 deletions doc/python/box-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,10 @@ fig.add_trace(go.Box(
))

fig.update_layout(
yaxis_title='normalized moisture',
yaxis=dict(
title=dict(
text='normalized moisture')
),
boxmode='group' # group together boxes of the different traces for each value of x
)
fig.show()
Expand Down Expand Up @@ -402,7 +405,7 @@ fig.add_trace(go.Box(
))

fig.update_layout(
xaxis=dict(title='normalized moisture', zeroline=False),
xaxis=dict(title=dict(text='normalized moisture'), zeroline=False),
boxmode='group'
)

Expand Down Expand Up @@ -479,7 +482,7 @@ for xd, yd, cls in zip(x_data, y_data, colors):
)

fig.update_layout(
title='Points Scored by the Top 9 Scoring NBA Players in 2012',
title=dict(text='Points Scored by the Top 9 Scoring NBA Players in 2012'),
yaxis=dict(
autorange=True,
showgrid=True,
Expand Down
6 changes: 3 additions & 3 deletions doc/python/bubble-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ fig.update_traces(mode='markers', marker=dict(sizemode='area',
sizeref=sizeref, line_width=2))

fig.update_layout(
title='Life Expectancy v. Per Capita GDP, 2007',
title=dict(text='Life Expectancy v. Per Capita GDP, 2007'),
xaxis=dict(
title='GDP per capita (2000 dollars)',
title=dict(text='GDP per capita (2000 dollars)'),
gridcolor='white',
type='log',
gridwidth=2,
),
yaxis=dict(
title='Life Expectancy (years)',
title=dict(text='Life Expectancy (years)'),
gridcolor='white',
gridwidth=2,
),
Expand Down
8 changes: 6 additions & 2 deletions doc/python/candlestick-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ fig = go.Figure(data=[go.Candlestick(x=df['Date'],
])

fig.update_layout(
title='The Great Recession',
yaxis_title='AAPL Stock',
title=dict(text='The Great Recession'),
yaxis=dict(
title=dict(
text='AAPL Stock'
)
),
shapes = [dict(
x0='2016-12-09', x1='2016-12-09', y0=0, y1=1, xref='x', yref='paper',
line_width=2)],
Expand Down
6 changes: 5 additions & 1 deletion doc/python/choropleth-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,11 @@ fig = go.Figure(data=go.Choropleth(
autocolorscale=False,
text=df['text'], # hover text
marker_line_color='white', # line markers between states
colorbar_title="Millions USD"
colorbar=dict(
title=dict(
text="Millions USD"
)
)
))

fig.update_layout(
Expand Down
10 changes: 5 additions & 5 deletions doc/python/colorscales.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ df = px.data.tips()
fig = px.density_heatmap(df, x="total_bill", y="tip", title="Customized color bar on this density plot")

fig.update_layout(coloraxis_colorbar=dict(
title="Number of Bills per Cell",
title=dict(text="Number of Bills per Cell"),
thicknessmode="pixels", thickness=50,
lenmode="pixels", len=200,
yanchor="top", y=1,
Expand All @@ -271,7 +271,7 @@ fig = px.parallel_coordinates(df, dimensions=["sepal_length", "sepal_width", "pe
(0.66, "blue"), (1.00, "blue")])

fig.update_layout(coloraxis_colorbar=dict(
title="Species",
title=dict(text="Species"),
tickvals=[1,2,3],
ticktext=["setosa","versicolor","virginica"],
lenmode="pixels", len=100,
Expand All @@ -291,7 +291,7 @@ df = px.data.gapminder().query("year == 2007")
fig = px.scatter(df, y="lifeExp", x="pop", color=np.log10(df["pop"]), hover_name="country", log_x=True)

fig.update_layout(coloraxis_colorbar=dict(
title="Population",
title=dict(text="Population"),
tickvals=[6,7,8,9],
ticktext=["1M", "10M", "100M", "1B"],
))
Expand Down Expand Up @@ -408,7 +408,7 @@ fig.add_trace(go.Scatter(
cmin=0,
color=values,
colorbar=dict(
title="Colorbar"
title=dict(text="Colorbar")
),
colorscale="Viridis"
),
Expand Down Expand Up @@ -659,7 +659,7 @@ fig = go.Figure(go.Heatmap(
colorbar=dict(
x=0.2,
xref="container",
title="Surface Heat"
title=dict(text="Surface Heat")
)
))

Expand Down
4 changes: 2 additions & 2 deletions doc/python/continuous-error-bars.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ fig = go.Figure([
)
])
fig.update_layout(
yaxis_title='Wind speed (m/s)',
title='Continuous, variable value error bars',
yaxis=dict(title=dict(text='Wind speed (m/s)')),
title=dict(text='Continuous, variable value error bars'),
hovermode="x"
)
fig.show()
Expand Down
4 changes: 2 additions & 2 deletions doc/python/contour-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ fig.add_trace(go.Contour(z=z, showscale=False, connectgaps=True), 1, 2)
fig.add_trace(go.Heatmap(z=z, showscale=False, zsmooth='best'), 2, 1)
fig.add_trace(go.Heatmap(z=z, showscale=False, connectgaps=True, zsmooth='best'), 2, 2)

fig['layout']['yaxis1'].update(title='Contour map')
fig['layout']['yaxis3'].update(title='Heatmap')
fig['layout']['yaxis1'].update(title=dict(text='Contour map'))
fig['layout']['yaxis3'].update(title=dict(text='Heatmap'))

fig.show()
```
Expand Down
9 changes: 8 additions & 1 deletion doc/python/county-choropleth.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ fig = ff.create_choropleth(
fips=fips, values=values, scope=['CA', 'AZ', 'Nevada', 'Oregon', ' Idaho'],
binning_endpoints=[14348, 63983, 134827, 426762, 2081313], colorscale=colorscale,
county_outline={'color': 'rgb(255,255,255)', 'width': 0.5}, round_legend_values=True,
legend_title='Population by County', title='California and Nearby States'
legend=dict(
title=dict(
text='Population by County'
)
),
title=dict(
text='California and Nearby States'
)
)
fig.layout.template = None
fig.show()
Expand Down
2 changes: 1 addition & 1 deletion doc/python/datashader.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ agg.values = np.log10(agg.values, where=np.logical_not(zero_mask))
agg.values[zero_mask] = np.nan
fig = px.imshow(agg, origin='lower', labels={'color':'Log10(count)'})
fig.update_traces(hoverongaps=False)
fig.update_layout(coloraxis_colorbar=dict(title='Count', tickprefix='1.e'))
fig.update_layout(coloraxis_colorbar=dict(title=dict(text='Count'), tickprefix='1.e'))
fig.show()
```
Loading