在R中显示两行图表

时间:2014-02-18 20:19:16

标签: r charts ggplot2 linechart

这是我在R中的代码:

datos_tem <- dbGetQuery(connection, paste("SELECT temp_int,hum_int,datetime FROM data WHERE host_id=69 and datetime>='2013-10-01' and datetime<='2013-10-03';", sep=""))
dbDisconnect(connection)

datos_tem$datetime <- as.date(datos_tem$datetime)
datos_tem$temp_int <- as.numeric(datos_tem$temp_int)
datos_tem$hum_int <- as.numeric(datos_tem$hum_int)

Molten <- melt(datos_tem, id.vars = "datetime")
print(Molten)
ggplot(Molten, aes(x = datetime, y = value, colour = variable)) + geom_line()

数据库temp_int,hum_intFloatdatetimeDatetime

当我运行它时,不显示线条,只显示轴,图例......,但是如果print (Molten)我的数据已经融化了:

enter image description here

0 个答案:

没有答案