8000 Update selections.md · Coding-with-Adam/plotly.py@6d1a2da · GitHub
[go: up one dir, main page]

Skip to content

Commit 6d1a2da

Browse files
committed
Update selections.md
1 parent 186dec4 commit 6d1a2da

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/python/selections.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ import plotly.express as px
5252
df = px.data.iris()
5353

5454
fig = px.scatter(df, x="sepal_width", y="sepal_length")
55-
fig.add_selection(type="rect", x0=3.0, y0=6.5, x1=3.5, y1=5.5)
55+
fig.add_selection(x0=3.0, y0=6.5, x1=3.5, y1=5.5)
5656

5757
fig.show()
5858
```
5959

60-
## Selections using Path
60+
## Selections Using a Custom SVG
6161

6262

63-
In the above example, we added a rectangular selection (`type="rect"`). You can also render a custom SVG for a selection by defining a `path` that can include single or multiple polygons. Here, we create a selection with a single polygon path "M2,6.5L4,7.5L4,6Z".
63+
In the above example, we added a rectangular selection. You can also render a custom SVG for a selection by defining a `path` that can include single or multiple polygons. Here, we create a selection with a single polygon path "M2,6.5L4,7.5L4,6Z".
6464

6565
Please note that multiple polygons e.g. "M0,0L0,10L10,10,L10,0Z M2,2L2,8L8,8,L8,2Z" could be used to subtract certain regions from the selection.
6666

@@ -70,7 +70,7 @@ import plotly.express as px
7070
df = px.data.iris()
7171

7272
fig = px.scatter(df, x="sepal_width", y="sepal_length")
73-
fig.add_selection(type="path", path="M2,6.5L4,7.5L4,6Z")
73+
fig.add_selection(path="M2,6.5L4,7.5L4,6Z")
7474

7575
fig.show()
7676
```
@@ -88,7 +88,7 @@ import plotly.express as px
8888
df = px.data.iris()
8989

9090
fig = px.scatter(df, x="sepal_width", y="sepal_length")
91-
fig.add_selection(type="rect",
91+
fig.add_selection(
9292
x0=2.5, y0=6.5, x1=3.5, y1=5.5,
9393
line=dict(
9494
color="Crimson",
@@ -110,7 +110,7 @@ import plotly.express as px
110110
df = px.data.iris()
111111

112112
fig = px.scatter(df, x="sepal_width", y="sepal_length")
113-
fig.add_selection(type="rect", x0=3.0, y0=6.5, x1=3.5, y1=5.5)
113+
fig.add_selection(x0=3.0, y0=6.5, x1=3.5, y1=5.5)
114114

115115
fig.update_layout(dragmode='select',
116116
activeselection=dict(fillcolor='yellow'))

0 commit comments

Comments
 (0)
0