Skip to content

Commit d7aa9e5

Browse files
committed
Update legend.md
1 parent 2249203 commit d7aa9e5

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

doc/python/legend.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jupyter:
88
format_version: '1.3'
99
jupytext_version: 1.14.1
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.8.8
23+
version: 3.8.0
2424
plotly:
2525
description: How to configure and style the legend in Plotly with Python.
2626
display_as: file_settings
@@ -199,20 +199,18 @@ Set the width of hozitonal legend entries by setting `entrywidth`. Here we set i
199199
import plotly.express as px
200200

201201
df = px.data.gapminder().query("year==2007")
202-
fig = px.scatter(
203-
df,
204-
x="gdpPercap",
205-
y="lifeExp",
206-
color="continent",
207-
size="pop",
208-
size_max=45,
209-
log_x=True,
210-
)
211-
fig.update_layout(
212-
legend=dict(
213-
orientation="h", entrywidth=70, yanchor="bottom", y=1.02, xanchor="right", x=1
214-
)
215-
)
202+
fig = px.scatter(df, x="gdpPercap", y="lifeExp", color="continent",
203+
size="pop", size_max=45, log_x=True)
204+
205+
fig.update_layout(legend=dict(
206+
orientation="h",
207+
entrywidth=70,
208+
yanchor="bottom",
209+
y=1.02,
210+
xanchor="right",
211+
x=1
212+
))
213+
216214
fig.show()
217215
```
218216

0 commit comments

Comments
 (0)