且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ggplot2:如何调整线条类型+图例中的顺序?

更新时间: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))

相关阅读

推荐文章