1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
library(ggplot2)
library(plotly)
id <- c(rep(1,12), rep(2,12))
age <- c(0, 2, 3, 4, 6, 13, 27, 41, 55, 60, 69, 83)
age2 <- age+1
age3 <- c(age, age2)
value <- c(0.15, 0.15, 0.15, 0.15, 0.05, 0.05, 0.20, 0.20, 0.05, 0.05, 0.05, 0.05)
value2 <- value+0.05
value3 <- c(value, value2)
statut <- c("+", "+", "+", "+", "-", "-", "-", "-", "-", "-", "-", "-")
statut2 <- c("-", "-", "+", "+", "+", "+", "-", "-", "-", "-", "-", "-")
statut3 <- c(statut, statut2)
df <- cbind.data.frame(id, age3, value3, statut3)
p <- ggplot(df) +
geom_line(aes(x = age3, y = value3, color = statut3, group = id)) +
scale_color_manual(values=c("steelblue", "tomato1"))
p |
Partager