Skip to content

Commit 075fa61

Browse files
author
mahdis-z
committed
itemsizing
1 parent 136f1d4 commit 075fa61

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

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+
### Legend Size
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,9,3,6,4], 'sizemode': 'diameter'}
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':[700,2000,400,1000,750], 'sizemode':'area'}
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)