第5章 用图层构建图像

2023-03-09  本文已影响0人  iBioinformatics

5.4.1 用图层构建图像

> ggplot(mpg, aes(displ,hwy,colour=class)) + 
    geom_point() + 
    geom_smooth(method="lm",se=FALSE)+
    theme(legend.position="none")


> ggplot(mpg, aes(displ,hwy)) + 
    geom_point(aes(colour=class)) + 
    geom_smooth(method="lm",se=FALSE)+
    theme(legend.position="none")


> ggplot(mpg, aes(displ,hwy)) + 
    geom_point() + 
    geom_smooth(aes(colour=class),method="lm",se=FALSE)+
    theme(legend.position="none")

5.4.2 设定和映射

ggplot(mpg,aes(cty,hwy))+
    geom_point(colour="darkblue")


ggplot(mpg,aes(cty,hwy))+
    geom_point(aes(colour="darkblue"))


ggplot(mpg,aes(cty,hwy))+
    geom_point(aes(colour="darkblue")) + 
    scale_colour_identity() 
>ggplot(mpg,aes(displ,hwy))+ 
    geom_point()+
    geom_smooth(aes(colour="loess"),method="loess",se=FALSE)+
    geom_smooth(aes(colour="lm"),method="lm",se=FALSE)+
    labs(colour="Method")


ggplot(mpg,aes(displ,hwy))+ 
    geom_point()+
    geom_smooth(aes(colour="pink"),method="loess",se=FALSE)+
    geom_smooth(aes(colour="green"),method="lm",se=FALSE)+
    labs(colour="Method")
上一篇 下一篇

猜你喜欢

热点阅读