The problem here is with the naming of your variable. Because you have too many “.” In your variable names. I removed “.” From your variable names and it seems to be working now.
# Create a new variable1 by removing dots
df1$variable1 <- as.factor(gsub(pattern="\\.",replacement="",x=df1$variable))
# Now plot your data you will see two lines
p <- ggplot(subset(df1,variable1==c("NETWM2","latent")),na.rm=T) + geom_line(aes(date,value,linetype=variable1))
p
Best,
Janesh Devkota
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hi Janesh, Thanks a lot, your tip did the trick. Is there any way to insert a legend and control the linetype of each line? I have been trying it with scale_color_manual and it didn't work. Best, |
Janesh, Thanks again, I made it. Best, |