I'm trying to set linetypes of variables, but scale_linetype_manual
is having no effect to the final plot.
I tried many solutions such as defining
scale_linetype_manual(name="Legend", values=c(1,2,1,2,1,2,1,2))
and defining my linetype directly in my dataframe.
Here is my dataframe appearence
X Y type
1 9 1A
1 7 1A
3 8 1A
4 7 2A
2 6 2A
1 7 2A
4 6 1B
5 7 1B
6 6 1B
So I made my ggplot like this:
legend.title = "Domains"
ggplot(df) +
geom_line(aes(x=X, y=Y, color=type)) +
xlim(0,50) +
scale_color_discrete(legend.title) +
scale_linetype_manual(name=legend.title, values=c(1,2,1,2,1,2,1,2,1,2))
Here is my result:
I'm only getting type 1 lines.
Do you have any idea? Thanks.