回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>下面的代码应该使用基于两个列表的plotly库来绘制图形:<code>ambTime</code>作为X轴,<code>domv1R1Temps</code>作为Y轴。
代码如下:</p>
<pre><code>import plotly.graph_objs as go
import plotly.offline as ply
from plotly import tools
ambTime = ['10:32:42.951', '10:32:42.951', '10:32:42.951', '10:32:42.951',
'10:32:42.951', '10:32:42.951', '10:32:42.951', '10:32:42.951',
'10:32:42.951', '10:32:42.951', '10:32:42.951', '10:32:42.951',
'10:32:42.951', '10:32:42.951', '10:32:53.117', '10:32:53.117',
'10:32:53.117', '10:32:53.117', '10:32:53.117', '10:32:53.117',
'10:32:53.117', '10:32:53.117', '10:32:53.117', '10:32:53.117',
'10:32:53.117', '10:32:53.117', '10:32:53.117', '10:32:53.117',
'10:33:03.273', '10:33:03.273', '10:33:03.273', '10:33:03.273',
'10:33:03.273', '10:33:03.273', '10:33:03.273', '10:33:03.273',
'10:33:03.273', '10:33:03.273', '10:33:03.273', '10:33:03.273',
'10:33:03.273', '10:33:03.273', '10:33:13.428', '10:33:13.428',
'10:33:13.428', '10:33:13.428', '10:33:13.428', '10:33:13.428',
'10:33:13.428', '10:33:13.428', '10:33:13.428', '10:33:13.428',
'10:33:13.428', '10:33:13.428', '10:33:13.428', '10:33:13.428',
'10:33:23.584', '10:33:23.584', '10:33:23.584', '10:33:23.584',
.
.
.
.
#This list contains 588 items. I shortened the list for the sake of time
.
.
.
.
'10:35:47.713', '10:35:57.884', '10:35:57.884', '10:35:57.884',
'10:35:57.884', '10:35:57.884', '10:35:57.884', '10:35:57.884',
'10:35:57.884', '10:35:57.884', '10:35:57.884', '10:35:57.884',
'10:35:57.884', '10:35:57.884', '10:35:57.884', '10:36:08.695',
'10:36:08.695', '10:36:08.695', '10:36:08.695', '10:36:08.695',
'10:36:08.695', '10:36:08.695', '10:36:08.695', '10:36:08.695',
'10:36:08.695', '10:36:08.695', '10:36:08.742', '10:36:08.742',
'10:36:08.742']
domv1R1Temps = ['27', '27', '27', '27', '27', '27', '27', '27', '27', '28',
'27', '27', '27', '27', '27', '27', '27', '27', '27', '27', '27']
Trace1 = go.Scatter(x= ambTime,y = domv1R1Temps, name='DOMV1 R1
Temperatures')
ambData = [Trace1]
ambLayout = go.Layout(
title='Ambient Temperature',
xaxis=dict(
title='Time',
),
yaxis=dict(
title='Y Axis'
)
)
fig = go.Figure(data=ambData, layout=ambLayout)
ply.plot(fig, filename="Ambient Temperature.html")
</code></pre>
<p>当我运行代码时,它会生成一个只有2个变量的图:请看一下图像</p>
<p><a href="https://i.stack.imgur.com/dsuHH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dsuHH.png" alt="enter image description here"/></a></p>
<p>但我想让图表显示列表中的每一项。我在想是否有人知道这里出了什么事</p>