美文网首页
每天码zi挑战之--ggplot2

每天码zi挑战之--ggplot2

作者: smyang2018 | 来源:发表于2019-07-03 20:20 被阅读0次

    qplot(carat,price,data=diamonds)
    qplot(carat,price,data=diamonds,alpha=I(1/10),colour=I("red"),geom=c("point","smooth"),size=I(2))
    qplot(carat,data=diamonds,colour=I("blue"),geom=c("histogram"))
    qplot(carat,data=diamonds,colour=I("red"),geom=c("histogram","density"),fill=I("red"))
    qplot(carat,data=diamonds,colour=I("blue"),geom=c("density"),fill=I("red"))
    qplot(carat,data=diamonds,colout=I("blue"),geom=c("bar"),fill=I("green"))
    qplot(carat,price,data=diamonds,geom=c("point","smooth"))
    qplot(carat,price,data=diamonds,geom=c("point","smooth"),size=I(2),colour=I("red"),alpha=I(1/10),fill=I("blue"))
    qplot(carat,price,data=diamonds,geom=c("point","smooth"),size=I(2),alpha=I(1/10),fill=I("blue"))
    qplot(carat,price,data=diamonds,geom=c("point","smooth"),span=0.2)
    qplot(carat,price,data=diamonds,geom=c("point","smooth"),span=0.5)
    qplot(carat,price,data=diamonds,geom=c("point","smooth"),span=0.5,colour=I("red"))
    set.seed(1410)
    dsmall<-diamonds[sample(nrow(diamonds),100),]
    qplot(carat,price,data=dsmall,geom=c("point","smooth"),method="gam",formula=y~s(x),size=I(2),colour=I("red"))
    qplot(carat,price,data=dsmall,geom=c("point","smooth"),method="gam",formula=y~s(x,bs="cs") )
    qplot(price,color,data=dsmall,geom="jitter",colour=I("red"),size=I(1),alpha=I(1/10))
    qplot(price,color,data=dsmall,geom="boxplot",colour=I("blue"),size=I(2))
    qplot(color,price/carat,data=diamonds,geom="jitter")
    qplot(color,price/carat,data=diamonds,geom="jitter",colour=I("red"),size=I(2),alpha=I(1/10))
    qplot(color,price/carat,data=diamonds,geom="jitter",colour=I("blue"),size=I(1.5),alpha=I(1/100))
    qplot(color,price/carat,data=diamonds,geom="jitter",,colour=I("green"),size=I(2),alpha=I(1/1000))
    qplot(carat,data=diamonds,geom="histogram")
    qplot(carat,data=diamonds,geom="histogram",colour=I("red"),fill=I("blue"))
    qplot(carat,data=diamonds,geom="histogram",colour=I("red"),fill=I("red"))
    qplot(carat,data=diamonds,geom="histogram",colout=I("blue"),fill=I("blue"))
    qplot(carat,data=diamonds,geom="density")
    qplot(carat,data=diamonds,geom="density",colour=I("red"),fill=I("red"))
    qplot(carat,data=diamonds,geom="density",colour=I("blue"),fill=I("red"),adjust=I(2))
    qplot(carat,data=diamonds,geom="density",colout=I("red"),fill=I("blue"),adjust=I(3))
    qplot(carat,data=dsmall,geom="histogram",binwidth=1,xlim=c(0,3))
    qplot(carat,data=diamonds,geom="histogram",binwidth=0.1,xlim=c(0,3))
    qplot(carat,data=diamonds,geom="histogram",binwidth=0.01,xlim=c(0,3))
    qplot(carat,data=diamonds,geom="density",colour=color)
    qplot(carat,data=diamonds,geom="histogram",colour=color)
    qplot(carat,data=diamonds,geom="density",colour=I("red"))
    qplot(carat,data=diamonds,geom="density",colour=I("red"),fill=I("blue"))
    qplot(carat,data=diamonds,geom="histogram",colour=I("black"),fill=I("red"))
    qplot(color,data=diamonds,geom="bar")
    qplot(color,data=diamonds,geom="bar",weight=carat)
    qplot(color,data=diamonds,geom="bar",weight=carat)+scale_y_continuous("carat")
    qplot(date,unemploy/pop,data=economics,geom="line")
    qplot(date,unemploy/pop,data=economics,geom="line",colour=I("red"),fill=I("blue"))
    qplot(unemploy/pop,uempmed,data=economics,geom=c("point","path"))
    qplot(unemploy/pop,uempmed,data=economics,geom=c("point","path"),colour=I("red"))
    qplot(carat,price,data=diamonds,geom=c("point"),colour=I("red"))
    qplot(carat,data=diamonds,facets=color~.,geom="histogram",binwidth=0.1,xlim=c(0,3))
    qplot(carat,data=diamonds,facets=color~.,geom="density",binwidth=0.01,xlim=c(0,3),colour=I("red"),fill=I("blue"))
    qplot(carat,price,data=diamonds,facets=cut~.,geom="boxplot",colour=I("red"),fill=I("blue"),alpha=I(1/10))
    qplot(carat,..density..,data=diamonds,facets=color~.,geom="histogram",binwidth=0.1,xlim=c(0,3),xlab="test picture",ylab="sample",main="just soso")
    qplot(carat,data=diamonds,facets=cut~.,geom="density",colour=I("blue"),fill=I("red"))
    qplot(carat,price,data=diamonds,facets=color~.,geom="jitter",colour=I("red"),fill=I("red"))

    相关文章

      网友评论

          本文标题:每天码zi挑战之--ggplot2

          本文链接:https://www.haomeiwen.com/subject/zkyhaqtx.html