Skip to content

Commit e2eb238

Browse files
committed
add time series example
1 parent 6d1a2da commit e2eb238

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

doc/python/selections.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,20 @@ fig.update_layout(dragmode='select',
136136
fig.show()
137137
```
138138

139+
## Selections with Time Series
140+
141+
Selections are also supported on time series figures. Here, we add a rectangular selection with a region between the dates `2019-01-01"` and `"2019-10-01"` on the x axis and between `1` and `1.15` on the y axis.
142+
143+
144+
```python
145+
import plotly.express as px
146+
147+
df = px.data.stocks()
148+
fig = px.line(df, x='date', y="GOOG")
149+
fig.add_selection(x0="2019-01-01", y0=1, x1="2019-10-01", y1=1.17)
150+
fig.show()
151+
```
152+
139153
## More on Selections
140154

141155
For more on selections, see the [selections section of the `dcc.Graph` page](https://dash.plotly.com/dash-core-components/graph#selections) in the Dash docs.

0 commit comments

Comments
 (0)