我从
开始>df57 <- data.frame(cellType = c("4.57","4.57","8.57","8.28.57","8.28.57"),ORR = c("PD","nonPD"),BL = rep(0,each=6),Treated = c(10,-5,8,-4,15,-2))
>df57melt <- melt(df57)
>df57melt
cellType ORR variable value
1 4.57 PD BL 0
2 4.57 nonPD BL 0
3 8.57 PD BL 0
4 8.57 nonPD BL 0
5 8.28.57 PD BL 0
6 8.28.57 nonPD BL 0
7 4.57 PD Treated 10
8 4.57 nonPD Treated -5
9 8.57 PD Treated 8
10 8.57 nonPD Treated -4
11 8.28.57 PD Treated 15
12 8.28.57 nonPD Treated -2
我想绘制一条线图,其中在x轴上显示处理(BL,已处理),在y轴上显示值(连续)。我想拥有三种具有响应变量的单元格类型(4.57、8.57和8.28.57;我希望通过线条颜色编码)(PD和nonPD;我希望通过线条样式进行编码)。
我标出了我认为应该起作用的地方:
>ggplot(data=df57melt,aes(x=variable,y = value)) +
geom_line(aes(linetype = ORR,color = cellType))
geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
#so I add group info
>ggplot(data=df57melt,y = value,group = cellType)) +
geom_line(aes(linetype = ORR,color = cellType))
Error: geom_path: If you are using dotted or dashed lines,colour,size and linetype must be constant over the line
#but if I change from categorical x to continuous x...
>ggplot(data=df57melt,aes(x=as.numeric(variable),color = cellType))