Skip to content

Commit 7a28a58

Browse files
committed
Update legend.md
1 parent 4e4fa6e commit 7a28a58

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

Diff for: doc/python/legend.md

+14-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.5
9+
jupytext_version: 1.14.6
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -580,7 +580,7 @@ fig.show()
580580

581581
By default, all traces appear on one legend. To have multiple legends, specify an alternative legend for a trace using the `legend` property. For a second legend, set `legend="legend2"`. Specify more legends with `legend="legend3"`, `legend="legend4"` and so on.
582582

583-
In this example, the last two scatter traces display on the second legend, "legend2". On the figure's layout, we then position and style this legend to display on the right of the graph below the first legend.
583+
In this example, the last two scatter traces display on the second legend, "legend2". On the figure's layout, we then position and style each legend.
584584

585585

586586
```python
@@ -622,20 +622,25 @@ fig = go.Figure(
622622
],
623623
layout=dict(
624624
title="GDP Per Capita",
625-
legend={"title": "By country", "bgcolor": "Orange",},
625+
legend={
626+
"title": "By country",
627+
"xref": "container",
628+
"yref": "container",
629+
"y": 0.65,
630+
"bgcolor": "Orange",
631+
},
626632
legend2={
627-
"x": 1.155,
628-
"y": 0.55,
629-
"xanchor": "right",
630-
"yanchor": "middle",
633+
"title": "By continent",
634+
"xref": "container",
635+
"yref": "container",
636+
"y": 0.85,
631637
"bgcolor": "Gold",
632-
"title": {"text": "By continent"},
638+
633639
},
634640
),
635641
)
636642

637643
fig.show()
638-
639644
```
640645

641646
### Positioning Legends
@@ -666,7 +671,6 @@ fig = go.Figure(
666671
"xref": "container",
667672
"yref": "container",
668673
"bgcolor": "Gold",
669-
"title": {"text": "By continent"},
670674
},
671675
),
672676
)

0 commit comments

Comments
 (0)