Skip to content

Commit 1d753ed

Browse files
committed
Update selections.md
1 parent b705619 commit 1d753ed

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

doc/python/selections.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,51 @@ fig.add_selection(x0="2019-01-01", y0=0.95, x1="2019-10-01", y1=1.15)
150150
fig.show()
151151
```
152152

153+
## Referencing Selections on a Scatterplot Matrix
154+
155+
156+
You can add selections to a scatteplot matrix by specifying `xref` and/or `yref`. Here, we add one selection on the plot with axis ids `x2` and `y2` and another on the plot with ids `x3` and `y`.
157+
158+
```python
159+
import plotly.express as px
160+
161+
df = px.data.iris()
162+
163+
fig = px.scatter_matrix(df,
164+
dimensions=["sepal_length", "sepal_width", "petal_length", "petal_width"],
165+
color="species")
166+
167+
fig.update_layout(
168+
xaxis = {"matches": "y"},
169+
xaxis2 = {"matches": "y2"},
170+
xaxis3 = {"matches": "y3"},
171+
xaxis4 = {"matches": "y4"},
172+
height = 900,
173+
width = 750,
174+
dragmode = 'select',
175+
selections = [
176+
dict(
177+
x0 = 3,
178+
x1 = 4,
179+
xref = "x2",
180+
y0 = 8,
181+
y1= 6,
182+
yref = "y"
183+
),
184+
dict(
185+
x0 = 5,
186+
x1 = 1,
187+
xref = "x3",
188+
y0 = 5,
189+
y1= 4,
190+
yref = "y",
191+
)
192+
]
193+
)
194+
195+
fig.show()
196+
```
197+
153198
## Referencing Selections on Multiple Cartesian Subplots
154199

155200

0 commit comments

Comments
 (0)