Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update legend.md
Add 'Hide the Trace Implicitly' section. 
Change 'Size of Legend Items' header from h3 to h4.
  • Loading branch information
SylwiaOliwia2 authored Feb 25, 2020
commit 4c2c57cacbd2b7a27ee68ae63eda2ca4c4d47db4
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