10000 Merge pull request #214 from plotly/itemsizing_legend · plotly/plotly.py-docs@3a61410 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a61410

Browse files
authored
Merge pull request #214 from plotly/itemsizing_legend
itemsizing
2 parents f831b7b + 023edca commit 3a61410

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

python/legend.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,32 @@ fig.update_layout(
217217

218218
fig.show()
219219
```
220+
### Size of Legend Items
220221

222+
In this example [itemsizing](https://plot.ly/python/reference/#layout-legend-itemsizing) attribute determines the legend items symbols remain constant, regardless of how tiny/huge the bubbles would be in the graph.
223+
```python
224+
import plotly.graph_objects as go
225+
226+
fig = go.Figure()
227+
228+
fig.add_trace(go.Scatter(
229+
x=[1, 2, 3, 4, 5],
230+
y=[1, 2, 3, 4, 5],
231+
mode='markers',
232+
marker={'size':10}
233+
))
234+
235+
fig.add_trace(go.Scatter(
236+
x=[1, 2, 3, 4, 5],
237+
y=[5, 4, 3, 2, 1],
238+
mode='markers',
239+
marker={'size':100}
240+
))
241+
242+
fig.update_layout(legend= {'itemsizing': 'constant'})
243+
244+
fig.show()
245+
```
221246
#### Grouped Legend
222247

223248
```python

0 commit comments

Comments
 (0)
0