You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/legend.md
+24-1
Original file line number
Diff line number
Diff line change
@@ -243,7 +243,30 @@ fig.update_layout(
243
243
fig.show()
244
244
```
245
245
246
-
### Size of Legend Items
246
+
#### Hide the Trace Implicitly
247
+
248
+
`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.
249
+
250
+
```python
251
+
import plotly.graph_objects as go
252
+
253
+
fig = go.Figure()
254
+
255
+
fig.add_trace(go.Scatter(
256
+
x=[1, 2, 3, 4, 5],
257
+
y=[1, 2, 3, 4, 5],
258
+
))
259
+
260
+
fig.add_trace(go.Scatter(
261
+
x=[1, 2, 3, 4, 5],
262
+
y=[5, 4, 3, 2, 1],
263
+
visible='legendonly'
264
+
))
265
+
266
+
fig.show()
267
+
```
268
+
269
+
#### Size of Legend Items
247
270
248
271
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.
0 commit comments