赞
踩
library(ggplot2)
library(plotly)
head(state.x77)
summary(state.x77)
state <- data.frame(state.name,state.region,state.x77)
attach(state)
state_p <- data.frame(state.name,state.region,Area)
p <- ggplot(state_p,aes(x=state_p$state.region,y=state_p$Area,fill=state_p$state.region)) + geom_boxplot() + ggtitle("美国不同地区州面积")
ggplotly(p)
plot_ly(state_p,x=state.region,y=Area,color = state.region,type = 'box')
pairs(state)
k <- ggplot(state,aes(x=Illiteracy,y=Murder,color=state.region)) + geom_point() + geom_smooth(method=lm, se=FALSE, fullrange=TRUE) + theme_classic()
ggplotly(k)
cor(state.x77)
q1 <- ggplot(state,aes(x=Murder,y=Life.Exp)) + geom_point() + geom_smooth(method=lm, se=FALSE, fullrange=TRUE) + theme_classic()
ggplotly(q1)
q2 <- ggplot(state,aes(x=Murder,y=Life.Exp,color=state.region)) + geom_point() + geom_smooth(method=lm, se=FALSE, fullrange=TRUE) + theme_classic()
ggplotly(q2)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。