Below is the a small dataset which i have tried to reproduce it to my best understanding.As in the attached plot you can observe that i am able to gradient in geom_point() but the same visuals i am trying for geom_line.Note : we are always been provided with data of
Tempand
var.The
cat` variable is not given in data set.
df=data.frame(seq=(1:30),Temp =rnorm(30,mean = 34 ,sd=18))
f=summary(df$Temp)
df$cat <- cut(df$Temp,
breaks=c(f[1], f[3] ,f[4] ,f[6]),
labels=c("low","medium","high"))
f=ggplot(df , aes(x=seq ,y= Temp,colour=cat))+ geom_line()
f
Gradient should as per High
, Medium
& Low
using geom_line() function in ggplot2.