正文
=
[
28.8
,
28.5
,
37.0
,
56.8
,
69.7
,
79.7
,
78.5
,
77.8
,
74.1
,
62.6
,
45.3
,
39.9
]
low_2014
=
[
12.7
,
14.3
,
18.6
,
35.5
,
49.9
,
58.0
,
60.0
,
58.6
,
51.7
,
45.2
,
32.2
,
29.1
]
# Create and style traces
trace0
=
go
.
Scatter
(
x
=
month
,
y
=
high_2014
,
name
=
'High 2014'
,
line
=
dict
(
color
=
(
'rgb(205, 12, 24)'
),
width
=
4
)
)
trace1
=
go
.
Scatter
(
x
=
month
,
y
=
low_2014
,
name
=
'Low 2014'
,
line
=
dict
(
color
=
(
'rgb(22, 96, 167)'
),
width
=
4
,)
)
trace2
=
go
.
Scatter
(
x
=
month
,
y
=
high_2007
,
name
=
'High 2007'
,
line
=
dict
(
color
=
(
'rgb(205, 12, 24)'
),
width
=
4
,
dash
=
'dash'
)
# dash options include 'dash', 'dot', and 'dashdot'
)
trace3
=
go
.
Scatter
(
x
=
month
,
y
=
low_2007
,
name
=
'Low 2007'
,
line
=
dict
(
color
=
(
'rgb(22, 96, 167)'
),
width
=
4
,
dash
=
'dash'
)
)
trace4
=
go
.
Scatter
(
x
=
month
,
y
=
high_2000
,
name
=
'High 2000'
,
line
=
dict
(
color
=
(
'rgb(205, 12, 24)'
),
width
=
4
,
dash
=
'dot'
)
)
trace5
=
go
.
Scatter
(
x
=
month
,
y
=
low_2000
,
name
=
'Low 2000'
,
line
=
dict
(
color
=
(
'rgb(22, 96, 167)'
),
width
=
4
,
dash
=
'dot'
)
)
data
=
[
trace0
,
trace1
,
trace2
,
trace3
,
trace4
,
trace5
]
# Edit the layout
layout
=
dict
(
title
=
'Average High and Low Temperatures in New York'
,
xaxis
=
dict
(
title
=
'Month'
),
yaxis
=
dict
(
title
=
'Temperature (degrees F)'
),
)
fig
=
dict
(
data
=
data
,
layout
=
layout
)
py
.