如何将图例的值从“2”和“3”更改为“Solid”和“Dotted”?
library(ggplot2)
ggplot(mtcars) +
geom_line(aes(x=mpg,y=cyl,linetype='2')) +
geom_line(aes(x=mpg,y=disp,linetype='3')) +
scale_linetype_discrete(name = "Lines Types aes")
答案 0 :(得分:1)
ggplot(mtcars) +
geom_line(aes(x=mpg,y=cyl,linetype='2')) +
geom_line(aes(x=mpg,y=disp,linetype='3')) +
scale_linetype_discrete(name = "Lines Types aes", labels = c("Solid","Dotted"))