The following code
p <- ggplot()+
geom_point(aes(v3,v2,color=factor(v1)),myData)+
scale_colour_manual(values = gradient,name="Property A")+
xlab("X Values")+
ylab("Y Values")+
theme(legend.position="bottom")
produce this plot with points separated by a property A
I want to connect the points sharing another property B. It should look something like this:
I already tried adding
geom_line(aes(v3,v2,color=factor(v4)),myData)
But with this approach the line and the points will be recognized as a single object which causes a problem with the legend.
Edit: The dput() of myData
structure(list(v1 = c(1L, 1L, 1L, 2L, 2L, 2L), v2 = c(8348.97159577052,
7681.30540986381, 6826.40361652663, 10795.9750463179, 10765.5654460646,
9444.74166746195), v3 = c(0.349130695948487, 0.338453160875985,
0.319725370654182, 0.621362929529391, 0.619078094211563, 0.616495725056279
), v4 = c(0.995, 0.95, 0.9, 1, 0.995, 0.99)), .Names = c("v1",
"v2", "v3", "v4"), row.names = c(NA, 6L), class = "data.frame")