I have a set of coordinates
(x, y) = (0, 2), (1, 3), (1, 2), (2, 4) (this is a simplified example)
Whenever there is an increase in the y-ordinate, I would like to join the coordinates by a continuous line. Whenever there is a decrease in the y-ordinate, I would like to join the coordinates by a dashed line. In the example above,
1.) the coordinates (0, 2) and (1, 3) are joined by a straight line,
2.) the coordinates (1, 3) and (1, 2) are joined by a dashed line, and
3.) the coordinates (1, 3) and (2, 4) are joined by a straight line.
Is it possible to do this using ggplot in R? So far, I could only have a continuous line joining the coordinates. (If this possibly makes anything easier, I only have a decrease in the y-ordinate when there is no change in the x-ordinate.)
Thank You for your help!
try this,