我试着在一个图上画出几个电器的温度。在
数据来自下面的dataframedf,我首先创建date列作为索引。在
df=df.set_index('Date')
Date Appliance Value (degrees)
2016-07-05 03:00:00 Thermometer 22
2016-08-06 16:00:00 Thermometer . 19
2016-12-07 21:00:00 . Thermometer . 25
2016-19-08 23:00:00 . Thermostat . 21
2016-25-09 06:00:00 . Thermostat . 20
2016-12-10 21:00:00 . Thermometer . 18
2016-10-11 21:00:00 . Thermostat . 21
2016-10-12 04:00:00 . Thermometer . 20
2017-01-01 07:00:00 . Thermostat . 19
2017-01-02 07:00:00 . Thermometer . 23
我们希望能够显示两个曲线:一个是温度计的温度,另一个是恒温器的温度,随着时间的推移,有两种不同的颜色。在
^{pr2}$ggplot更好吗?在
我做不到
当然有几种绘制数据的方法。
假设我们有这样一个数据帧
使用matplotlib
^{pr2}$pyplot.plot()
使用熊猫
DataFrame.plot()
相关问题 更多 >
编程相关推荐