Skip to content

Commit 51e599e

Browse files
committed
Update selections.md
1 parent c674802 commit 51e599e

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

doc/python/selections.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -150,51 +150,6 @@ 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 scatterplot 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-
198153
## Referencing Selections on Multiple Cartesian Subplots
199154

200155

@@ -307,6 +262,51 @@ fig.update_layout(
307262
)
308263

309264

265+
fig.show()
266+
```
267+
268+
## Referencing Selections on a Scatterplot Matrix
269+
270+
271+
You can add selections to a scatterplot 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`.
272+
273+
```python
274+
import plotly.express as px
275+
276+
df = px.data.iris()
277+
278+
fig = px.scatter_matrix(df,
279+
dimensions=["sepal_length", "sepal_width", "petal_length", "petal_width"],
280+
color="species")
281+
282+
fig.update_layout(
283+
xaxis = {"matches": "y"},
284+
xaxis2 = {"matches": "y2"},
285+
xaxis3 = {"matches": "y3"},
286+
xaxis4 = {"matches": "y4"},
287+
height = 900,
288+
width = 750,
289+
dragmode = 'select',
290+
selections = [
291+
dict(
292+
x0 = 3,
293+
x1 = 4,
294+
xref = "x2",
295+
y0 = 8,
296+
y1= 6,
297+
yref = "y"
298+
),
299+
dict(
300+
x0 = 5,
301+
x1 = 1,
302+
xref = "x3",
303+
y0 = 5,
304+
y1= 4,
305+
yref = "y",
306+
)
307+
]
308+
)
309+
310310
fig.show()
311311
```
312312

0 commit comments

Comments
 (0)