更新时间:2023-11-26 23:48:46
Use method
as the linetype
, but then manually map it to the types of lines you want. You don't need to introduce another variable this way.
ggplot(df, aes(x=x, y=value)) +
geom_point() +
geom_line(aes(linetype=method)) +
scale_linetype_manual(breaks=c("a","b"), values=c(5,3))