我制作了一个脚本,它从嵌套列表(温度和变化)中的数据生成图表。
#!/usr/bin/python
import matplotlib.pyplot as plt
temperature = [['65', '65.5', '66', '66.5', '67', '67.5', '68', '68.5', '69', '69.5', '70', '70.5', '71', '71.5', '72', '72.5', '73', '73.5', '74', '74.5', '75', '75.5', '76', '76.5', '77', '77.5', '78', '78.5', '79', '79.5', '80', '80.5', '81', '81.5', '82', '82.5', '83', '83.5', '84', '84.5', '85', '85.5', '86', '86.5', '87', '87.5', '88', '88.5', '89', '89.5', '90', '90.5', '91', '91.5', '92', '92.5', '93', '93.5', '94', '94.5', '95'], ['65', '65.5', '66', '66.5', '67', '67.5', '68', '68.5', '69', '69.5', '70', '70.5', '71', '71.5', '72', '72.5', '73', '73.5', '74', '74.5', '75', '75.5', '76', '76.5', '77', '77.5', '78', '78.5', '79', '79.5', '80', '80.5', '81', '81.5', '82', '82.5', '83', '83.5', '84', '84.5', '85', '85.5', '86', '86.5', '87', '87.5', '88', '88.5', '89', '89.5', '90', '90.5', '91', '91.5', '92', '92.5', '93', '93.5', '94', '94.5', '95'], ['65', '65.5', '66', '66.5', '67', '67.5', '68', '68.5', '69', '69.5', '70', '70.5', '71', '71.5', '72', '72.5', '73', '73.5', '74', '74.5', '75', '75.5', '76', '76.5', '77', '77.5', '78', '78.5', '79', '79.5', '80', '80.5', '81', '81.5', '82', '82.5', '83', '83.5', '84', '84.5', '85', '85.5', '86', '86.5', '87', '87.5', '88', '88.5', '89', '89.5', '90', '90.5', '91', '91.5', '92', '92.5', '93', '93.5', '94', '94.5', '95']]
changes = [['94.566', '94.210', '93.836', '93.443', '93.030', '92.597', '92.145', '91.673', '91.181', '90.669', '90.137', '89.585', '89.011', '88.409', '87.760', '87.019', '86.063', '84.577', '81.806', '76.130', '65.071', '47.659', '28.454', '14.158', '6.305', '2.678', '1.128', '0.480', '0.210', '0.095', '0.045', '0.022', '0.012', '0.006', '0.004', '0.002', '0.002', '0.001', '0.001', '0.001', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000'], ['94.566', '94.210', '93.836', '93.443', '93.030', '92.597', '92.145', '91.673', '91.181', '90.669', '90.138', '89.588', '89.016', '88.420', '87.788', '87.088', '86.239', '85.028', '82.929', '78.744', '70.282', '55.446', '36.209', '19.361', '8.976', '3.874', '1.634', '0.691', '0.298', '0.132', '0.060', '0.029', '0.015', '0.008', '0.004', '0.003', '0.002', '0.001', '0.001', '0.001', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000'], ['94.566', '94.210', '93.836', '93.443', '93.030', '92.597', '92.145', '91.673', '91.181', '90.669', '90.138', '89.588', '89.016', '88.421', '87.790', '87.093', '86.255', '85.072', '83.059', '79.131', '71.434', '58.441', '41.784', '25.977', '14.170', '6.919', '3.146', '1.386', '0.608', '0.270', '0.122', '0.057', '0.028', '0.014', '0.007', '0.004', '0.003', '0.001', '0.001', '0.001', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000', '0.000']]
products=[]
for t,c in zip(temperature,changes):
products.append(t)
products.append(c)
plt.plot(*products)
plt.xlabel('temperature')
plt.ylabel('changes')
plt.show()
图表如下所示:
只是想知道如何制作图表的差异化版本(EG 随温度变化的速率)?
我尝试使用的绘制导数的示例都处理两个或三个数字,没有这么大和嵌套的数字,因此我很难尝试将它们应用于我的数据集。(生成并输入此脚本的数据始终采用嵌套列表的形式)。