Aesthetics can be set or mapped within a ggplot call.
- An aesthetic defined within aes(...) is mapped from the data, and a legend created.
- An aesthetic may also be set to a single value, by defining it outside aes().
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 lightblue
and darkblue
(see ?colors
for more details)
ggplot() +
geom_line(data=mya, aes(x=a, y=a, colour='light'), size = 2) +
geom_point(data=mya, aes(x=a, y=a, colour='dark'), size = 2) +
scale_colour_manual(values = setNames(c('darkblue','lightblue'),
c('dark','light')), guide = 'none') +
theme_bw()