I want to plot a path and show where the datapoints are.
Combine Points with lines with ggplot2
uses geom_point() + geom_line() but I do not like that the dots are much thicker and the lines have a discontinuous look - x - x ----- x --- thus I decidet to
create my own dotted line:
mya <- data.frame(a=1:20)
ggplot() +
geom_path(data=mya, aes(x=a, y=a, colour=2, size=1)) +
geom_point(data=mya, aes(x=a, y=a, colour=1, size=1)) +
theme_bw() +
theme(text=element_text(size=11))

I like that the dots and the line have the same size. I did not use the alpha channel because I fear trouble with the alpha channel when I include the files in other programs.
open problems:
- R should not create those legends
- can R calculate the “darker colour” itself?
darker(FF0000) = AA0000 - how can I manipulate the linethickness? The
size=parameter did not work as expected inR 2.15
Aesthetics can be set or mapped within a ggplot call.
In your case it appears you want to set the size to a single value. You can also use
scale_..._manual(values = ..., guide = 'none')to suppress the creation of a legend.This appears to be what you want with
colour.You can then use named colours such as
lightblueanddarkblue(see?colorsfor more details)