Skip to content

Commit

Permalink
Merge pull request #2227 from SylwiaOliwia2/patch-2
Browse files Browse the repository at this point in the history
Update legend.md
  • Loading branch information
nicolaskruchten authored Feb 26, 2020
2 parents 5aa8c16 + 4c2c57c commit a5291db
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion doc/python/legend.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,30 @@ fig.update_layout(
fig.show()
```

### Size of Legend Items
#### Hide the Trace Implicitly

`Graph_objects` traces have a `visible` attribute. If set to `legendonly`, the trace is hidden from the graph implicitly. Click on the name in the legend to display the hidden trace.

```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],
))

fig.add_trace(go.Scatter(
x=[1, 2, 3, 4, 5],
y=[5, 4, 3, 2, 1],
visible='legendonly'
))

fig.show()
```

#### 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.

Expand Down

0 comments on commit a5291db

Please sign in to comment.