Skip to content
Prev 308475 / 398506 Next

ggplot specify line type

On 10/19/2012 11:42 AM, autumnlin wrote:
Yes
Use a geom_point() where the shape aesthetic is mapped to the grouping 
variable and also add a geom_line(). If your horizontal axis is 
discrete, then you will need to set the grouping in the geom_line() 
correctly.

This answer is vague because the question was. Reproducible data and 
examples are appreciated/expected.  Here is code for a similar sort of 
graph.

ggplot(mtcars, aes(x=mpg, y=wt, shape=factor(carb))) +
     geom_point() +
     geom_line()