geom_line и групповая эстетика - PullRequest
0 голосов
/ 29 мая 2019

Функция geom_line не учитывает эстетику группы, представленную в функции ggplot

model <- lm(bd[,8]~bd[,2], bd)
summary(model)
bd <- cbind(bd, predict.lm(model, interval = "prediction"))
loc <- as.factor(bd[,5])
phyl <-as.factor(bd[,4])
bd <- as.data.frame(bd)
fitlwr <- bd[,10]
fitupr <- bd[,11]

X <- ggplot(bd, aes(group=loc))+ 
  geom_line(aes(y=lwr), color = "red", linetype = "dashed")+
  geom_line(aes(y=upr), color = "red", linetype = "dashed")+
  geom_point(aes(bd[,2], bd[,8], alpha=0.2, color=phyl,size=1)) + 
  geom_smooth(method="lm", formula=y~x, se=T, aes(group=loc)) +
  theme_minimal() +
  theme(legend.position = "bottom") +
  theme(axis.text=element_text(size=7), axis.title.x=element_text(size=11), axis.title.y=element_text(size=11)) + 
  xlab("GM") + 
  ylab("ZC") 
X

ggplot фактически отображает прогнозируемые значения upr и lwr, но не учитывает эстетику группы, предоставленную в функции ggplot

...