Achal Neupane
Achal Neupane

Reputation: 5719

How to plot continuous lines in R?

How can I plot this kind of data where I need continous lines for samples? I want three lines for samples A,B and C; values being in Y axis and rec in X axis.

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))

Upvotes: 1

Views: 2057

Answers (1)

Kipras Kančys
Kipras Kančys

Reputation: 1779

You can do that by using ggplot2

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

Upvotes: 3

Related Questions