File tree 1 file changed +41
-2
lines changed
1 file changed +41
-2
lines changed Original file line number Diff line number Diff line change 6
6
extension : .md
7
7
format_name : markdown
8
8
format_version : ' 1.3'
9
- jupytext_version : 1.14.7
9
+ jupytext_version : 1.16.1
10
10
kernelspec :
11
11
display_name : Python 3 (ipykernel)
12
12
language : python
@@ -20,7 +20,7 @@ jupyter:
20
20
name : python
21
21
nbconvert_exporter : python
22
22
pygments_lexer : ipython3
23
- version : 3.10.4
23
+ version : 3.10.11
24
24
plotly :
25
25
description : How to configure and style the legend in Plotly with Python.
26
26
display_as : file_settings
@@ -546,6 +546,45 @@ fig.update_layout(title="Try Clicking on the Legend Items!")
546
546
fig.show()
547
547
```
548
548
549
+ ``` python
550
+ df = data.iris()
551
+ df
552
+ ```
553
+
554
+ #### Indent Legend Entries
555
+
556
+ * New in 5.20*
557
+
558
+ To indent legend entries, set ` indenation ` on ` layout.legend ` to a number of pixels. In the following example, we indent legend entries by 10 pixels.
559
+
560
+ ``` python
561
+ import plotly.graph_objects as go
562
+ from plotly import data
563
+
564
+ df = data.iris()
565
+
566
+ fig = go.Figure(
567
+ [
568
+ go.Scatter(
569
+ x = df[df[" species" ] == species][" sepal_width" ],
570
+ y = df[df[" species" ] == species][" sepal_length" ],
571
+ mode = " markers" ,
572
+ name = species,
573
+ )
574
+ for species in df[" species" ].unique()
575
+ ],
576
+ layout = dict (
577
+ legend = dict (
578
+ title = " Species" ,
579
+ indentation = 10
580
+ )
581
+ ),
582
+ )
583
+
584
+
585
+ fig.show()
586
+ ```
587
+
549
588
#### Group click toggle behavior
550
589
551
590
* New in v5.3*
You can’t perform that action at this time.
0 commit comments