From 075fa61ef44b1f6284be184d21e4dcf130ca23d4 Mon Sep 17 00:00:00 2001 From: mahdis-z Date: Mon, 25 Nov 2019 13:40:51 -0500 Subject: [PATCH 1/2] itemsizing --- python/legend.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/python/legend.md b/python/legend.md index 1e6d7d58f..405142ed8 100644 --- a/python/legend.md +++ b/python/legend.md @@ -217,7 +217,32 @@ fig.update_layout( fig.show() ``` +### Legend Size +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. +```python +import plotly.graph_objects as go + +fig = go.Figure() + +fig.add_trace(go.Scatter( + x=[1, 2, 3, 4, 5], + y=[1, 2, 3, 4, 5], + mode='markers', + marker={'size':[10,9,3,6,4], 'sizemode': 'diameter'} +)) + +fig.add_trace(go.Scatter( + x=[1, 2, 3, 4, 5], + y=[5, 4, 3, 2, 1], + mode='markers', + marker={'size':[700,2000,400,1000,750], 'sizemode':'area'} +)) + +fig.update_layout(legend= {'itemsizing': 'constant'}) + +fig.show() +``` #### Grouped Legend ```python From 023edca96faa3f655ae9d2ec4bba7234d278ddec Mon Sep 17 00:00:00 2001 From: mahdis-z Date: Mon, 25 Nov 2019 16:41:56 -0500 Subject: [PATCH 2/2] minor modification --- python/legend.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/legend.md b/python/legend.md index 405142ed8..c7aa70e29 100644 --- a/python/legend.md +++ b/python/legend.md @@ -217,7 +217,7 @@ fig.update_layout( fig.show() ``` -### Legend Size +### Size of Legend Items 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. ```python @@ -229,14 +229,14 @@ fig.add_trace(go.Scatter( x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5], mode='markers', - marker={'size':[10,9,3,6,4], 'sizemode': 'diameter'} + marker={'size':10} )) fig.add_trace(go.Scatter( x=[1, 2, 3, 4, 5], y=[5, 4, 3, 2, 1], mode='markers', - marker={'size':[700,2000,400,1000,750], 'sizemode':'area'} + marker={'size':100} )) fig.update_layout(legend= {'itemsizing': 'constant'})