问题描述
在下面的代码中,fullrange = TRUE似乎被忽略。
任何想法有什么不对?
<$ (119,118,144,127,78.8,98.4,108,50,74,30.4,
50,72,99,155,113,144,102,131,105,127,120,85,153, 40.6,133),
y= c(1.56,2.17,0.81,1.07,1.12,2.03,0.90,1.48,0.64,
0.91,0.85,0.41,0.55,2.18,1.49,1.56 ,0.82,0.93,0.84,1.84,
0.78,1.15,3.85,3.30,0.94))
图书馆(ggplot2)
图书馆(MASS)
ggplot(df,aes(x = x,y = y))+ geom_point(size = 3,color =black)+
stat_smooth(method =rlm,alpha = 0.1,fullrange = TRUE ,se = TRUE)+
theme_bw()+
theme(text = element_text(size = 12),axis.title.y = element_text(size = 12,face =bold),
axis.title.x = element_text(size = 12,face =bold),
axis.line = element_line(color =darkgrey),
panel.border = element_blank()) + coord_cartesian(xlim = c(0,200),ylim = c(0,4))
您必须添加 + xlim( 0,200)
!
In the following code, fullrange=TRUE appears to be ignored.
Any ideas what's wrong?
df <- data.frame("x"=c(119,118,144,127,78.8,98.4,108,50,74,30.4,
50,72,99,155,113,144,102,131,105,127,120,85,153,40.6,133),
"y"=c(1.56,2.17,0.81,1.07,1.12,2.03,0.90,1.48,0.64,
0.91,0.85,0.41,0.55,2.18,1.49,1.56,0.82,0.93,0.84,1.84,
0.78,1.15,3.85,3.30,0.94))
library(ggplot2)
library(MASS)
ggplot(df,aes(x=x,y=y))+geom_point(size=3,colour="black")+
stat_smooth(method="rlm",alpha=0.1,fullrange=TRUE,se=TRUE)+
theme_bw()+
theme(text = element_text(size=12),axis.title.y=element_text(size=12,face="bold"),
axis.title.x=element_text(size=12,face="bold"),
axis.line = element_line(colour = "darkgrey"),
panel.border = element_blank())+coord_cartesian(xlim=c(0,200),ylim=c(0,4))
You have to add + xlim(0,200)
!
这篇关于在stat_smooth中忽略fullrange = TRUE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!