Skip to content

Commit e955334

Browse files
committed
Update selections.md
1 parent 3682408 commit e955334

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

doc/python/selections.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@ fig.add_selection(type="rect", x0=3.0, y0=6.5, x1=3.5, y1=5.5)
5757
fig.show()
5858
```
5959

60+
## Selections using Path
61+
62+
63+
In the above example, we added a rectangular selection (`type="rect"`). You can also render a custom SVG for a selection by setting `type="path"` and defining a `path`. Here, we create a selection with the path "M2,6.5L4,7.5L4,6Z"
64+
65+
```python
66+
import plotly.express as px
67+
68+
df = px.data.iris()
69+
70+
fig = px.scatter(df, x="sepal_width", y="sepal_length")
71+
fig.add_selection(type="path", path="M2,6.5L4,7.5L4,6Z")
72+
73+
fig.show()
74+
```
75+
6076
## Styling Selections
6177

6278

@@ -84,7 +100,7 @@ fig.show()
84100

85101
## Fill Color for Active Selections
86102

87-
You can style the active selection with `activeselection`. A selection is active when it is selected or created. In this example, we set active selections to appear with a `fillcolor` of `yellow`.
103+
You can style the active selection with `activeselection`. In this example, we set active selections (when created or clicked) to appear with a `fillcolor` of `yellow`.
88104

89105
```python
90106
import plotly.express as px

0 commit comments

Comments
 (0)