更改 R 中 ggplot 中特定线条的线条粗细
Change line thickness for specific line in ggplot in R
我想将 State = "A"
的线宽更改为 2,但 scale_size_manual
似乎不适用于 stat_smooth
类型的线图。
有人可以让我知道如何针对这种特定情况更改线条粗细吗?
aaa = data.frame(State=rep(c("A","B","C"),100),x= rnorm(300),y=rnorm(300))
ggplot(aaa,aes(x=x, y=y,col=State))+
geom_point() +
stat_smooth(method=glm,se=FALSE,aes(col=State)) +
scale_size_manual(values = c(2,1,1))
在stat_smooth
中添加size=State
,即:
ggplot(aaa,aes(x=x, y=y,col=State))+
geom_point() +
stat_smooth(method=glm,se=FALSE,aes(col=State,size=State)) +
scale_size_manual(values = c(2,1,1))
我想将 State = "A"
的线宽更改为 2,但 scale_size_manual
似乎不适用于 stat_smooth
类型的线图。
有人可以让我知道如何针对这种特定情况更改线条粗细吗?
aaa = data.frame(State=rep(c("A","B","C"),100),x= rnorm(300),y=rnorm(300))
ggplot(aaa,aes(x=x, y=y,col=State))+
geom_point() +
stat_smooth(method=glm,se=FALSE,aes(col=State)) +
scale_size_manual(values = c(2,1,1))
在stat_smooth
中添加size=State
,即:
ggplot(aaa,aes(x=x, y=y,col=State))+
geom_point() +
stat_smooth(method=glm,se=FALSE,aes(col=State,size=State)) +
scale_size_manual(values = c(2,1,1))