Skip to content

Commit a10c930

Browse files
committed
Update dropdowns.md
1 parent edbcd34 commit a10c930

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Diff for: doc/python/dropdowns.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
9-
jupytext_version: 1.3.2
8+
format_version: '1.3'
9+
jupytext_version: 1.14.1
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.3
23+
version: 3.8.0
2424
plotly:
2525
description: How to add dropdowns to update Plotly chart attributes in Python.
2626
display_as: controls
@@ -362,26 +362,26 @@ fig = go.Figure()
362362
# Add Traces
363363

364364
fig.add_trace(
365-
go.Scatter(x=list(df.index),
365+
go.Scatter(x=list(df.Date),
366366
y=list(df.High),
367367
name="High",
368368
line=dict(color="#33CFA5")))
369369

370370
fig.add_trace(
371-
go.Scatter(x=list(df.index),
371+
go.Scatter(x=list(df.Date),
372372
y=[df.High.mean()] * len(df.index),
373373
name="High Average",
374374
visible=False,
375375
line=dict(color="#33CFA5", dash="dash")))
376376

377377
fig.add_trace(
378-
go.Scatter(x=list(df.index),
378+
go.Scatter(x=list(df.Date),
379379
y=list(df.Low),
380380
name="Low",
381381
line=dict(color="#F06A6A")))
382382

383383
fig.add_trace(
384-
go.Scatter(x=list(df.index),
384+
go.Scatter(x=list(df.Date),
385385
y=[df.Low.mean()] * len(df.index),
386386
name="Low Average",
387387
visible=False,
@@ -393,17 +393,17 @@ high_annotations = [dict(x="2016-03-01",
393393
xref="x", yref="y",
394394
text="High Average:<br> %.3f" % df.High.mean(),
395395
ax=0, ay=-40),
396-
dict(x=df.High.idxmax(),
396+
dict(x=df.Date[df.High.idxmax()],
397397
y=df.High.max(),
398398
xref="x", yref="y",
399399
text="High Max:<br> %.3f" % df.High.max(),
400-
ax=0, ay=-40)]
400+
ax=-40, ay=-40)]
401401
low_annotations = [dict(x="2015-05-01",
402402
y=df.Low.mean(),
403403
xref="x", yref="y",
404404
text="Low Average:<br> %.3f" % df.Low.mean(),
405405
ax=0, ay=40),
406-
dict(x=df.High.idxmin(),
406+
dict(x=df.Date[df.High.idxmin()],
407407
y=df.Low.min(),
408408
xref="x", yref="y",
409409
text="Low Min:<br> %.3f" % df.Low.min(),

0 commit comments

Comments
 (0)