@@ -5,10 +5,10 @@ jupyter:
5
5
text_representation :
6
6
extension : .md
7
7
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
10
10
kernelspec :
11
- display_name : Python 3
11
+ display_name : Python 3 (ipykernel)
12
12
language : python
13
13
name : python3
14
14
language_info :
@@ -20,7 +20,7 @@ jupyter:
20
20
name : python
21
21
nbconvert_exporter : python
22
22
pygments_lexer : ipython3
23
- version : 3.7.3
23
+ version : 3.8.0
24
24
plotly :
25
25
description : How to add dropdowns to update Plotly chart attributes in Python.
26
26
display_as : controls
@@ -362,26 +362,26 @@ fig = go.Figure()
362
362
# Add Traces
363
363
364
364
fig.add_trace(
365
- go.Scatter(x = list (df.index ),
365
+ go.Scatter(x = list (df.Date ),
366
366
y = list (df.High),
367
367
name = " High" ,
368
368
line = dict (color = " #33CFA5" )))
369
369
370
370
fig.add_trace(
371
- go.Scatter(x = list (df.index ),
371
+ go.Scatter(x = list (df.Date ),
372
372
y = [df.High.mean()] * len (df.index),
373
373
name = " High Average" ,
374
374
visible = False ,
375
375
line = dict (color = " #33CFA5" , dash = " dash" )))
376
376
377
377
fig.add_trace(
378
- go.Scatter(x = list (df.index ),
378
+ go.Scatter(x = list (df.Date ),
379
379
y = list (df.Low),
380
380
name = " Low" ,
381
381
line = dict (color = " #F06A6A" )))
382
382
383
383
fig.add_trace(
384
- go.Scatter(x = list (df.index ),
384
+ go.Scatter(x = list (df.Date ),
385
385
y = [df.Low.mean()] * len (df.index),
386
386
name = " Low Average" ,
387
387
visible = False ,
@@ -393,17 +393,17 @@ high_annotations = [dict(x="2016-03-01",
393
393
xref = " x" , yref = " y" ,
394
394
text = " High Average:<br> %.3f " % df.High.mean(),
395
395
ax = 0 , ay = - 40 ),
396
- dict (x = df.High.idxmax(),
396
+ dict (x = df.Date[df. High.idxmax()] ,
397
397
y = df.High.max(),
398
398
xref = " x" , yref = " y" ,
399
399
text = " High Max:<br> %.3f " % df.High.max(),
400
- ax = 0 , ay = - 40 )]
400
+ ax = - 40 , ay = - 40 )]
401
401
low_annotations = [dict (x = " 2015-05-01" ,
402
402
y = df.Low.mean(),
403
403
xref = " x" , yref = " y" ,
404
404
text = " Low Average:<br> %.3f " % df.Low.mean(),
405
405
ax = 0 , ay = 40 ),
406
- dict (x = df.High.idxmin(),
406
+ dict (x = df.Date[df. High.idxmin()] ,
407
407
y = df.Low.min(),
408
408
xref = " x" , yref = " y" ,
409
409
text = " Low Min:<br> %.3f " % df.Low.min(),
0 commit comments