fullrange = TRUE ignored in stat_smooth

亡梦爱人 提交于 2019-12-11 19:38:12

问题


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))

回答1:


You have to add + xlim(0,200)!



来源:https://stackoverflow.com/questions/17489243/fullrange-true-ignored-in-stat-smooth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!