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
+44
Original file line number
Diff line number
Diff line change
@@ -360,5 +360,49 @@ fig.add_trace(go.Scatter(
360
360
fig.show()
361
361
```
362
362
363
+
### Legend items for continuous fields (2D and 3D)
364
+
365
+
Traces corresponding to 2D fields (e.g. `go.Heatmap`, `go.Histogram2d`) or 3D fields (e.g. `go.Isosurface`, `go.Volume`, `go.Cone`) can also appear in the legend. They come with legend icons corresponding to each trace type, which are colored using the same colorscale as the trace.
366
+
367
+
The example below explores a vector field using several traces. Note that you can click on legend items to hide or to select (with a double click) a specific trace. This will make the exploration of your data easier!
368
+
369
+
```python
370
+
import numpy as np
371
+
import plotly.graph_objects as go
372
+
373
+
# Define vector and scalar fields
374
+
x, y, z = np.mgrid[0:1:8j, 0:1:8j, 0:1:8j]
375
+
u = np.sin(np.pi*x) * np.cos(np.pi*z)
376
+
v =-2*np.sin(np.pi*y) * np.cos(2*np.pi*z)
377
+
w = np.cos(np.pi*x)*np.sin(np.pi*z) + np.cos(np.pi*y)*np.sin(2*np.pi*z)
0 commit comments