2016-05-01 127 views
1

如何绘制这样的数据,我需要连续的样品线?我需要三行样本A,B和C;值在Y轴和rec在X轴。如何绘制R中的连续线?

mydata<- structure(list(samples = structure(c(1L, 2L, 3L, 1L, 2L, 3L), .Label = c("A", 
"B", "c"), class = "factor"), value = c(1, 8, 7, 2, 5, 9), rec = c(7158, 
6975, 6573, 1122, 2235, 229)), .Names = c("samples", "value", 
"rec"), class = "data.frame", row.names = c(NA, -6L)) 

回答

3

你可以通过使用GGPLOT2

library(ggplot2) 
ggplot(mydata, aes(x = rec, y = value)) + geom_line(aes(group = samples))