【发布时间】:2017-11-03 16:46:48
【问题描述】:
这是数据集
group <- c(1,2,3,1,2,3)
species <- c("rabbit","rabbit","rabbit","plant","plant","plant")
t1 <- c(66,77,80,4,3,1)
t2 <- c(4,5,22,1,2,6)
t100 <- c(56,78,22,1,6,7)
df <- data.frame(group, species,t1,t2,t100)
其中 ti 表示第 i 个时间帧的时间。在我的原始数据集中,我有 100 个这样的列。
我需要为数据绘制时间序列,使具有相同组号的行具有相同的颜色线,但符号不同 (pch)。理想情况下,“兔子”类别需要一个符号,“植物”类别需要另一个符号。
这是我的尝试
time <- c(1,2,100)
library(ggplot2)
ggplot(df, aes(x = time, y=df[,3:5], colour = group)) #I don't know how to take it from here
【问题讨论】: