qplot |图表 | R 数据可视化 |通过...分组
qplot | ggplot | R data Visualization | group by
请帮助和评论。
使用数据集 msleep,针对 bodywt 和 sleep_total 因素绘制 qplot,并使用 geo_smooth 添加一条线。
使用 qplot 绘制一条线,应用线性回归模型去除标准误差。
按沃尔分组。
将模型分成多面体。
names(msleep):"name" "genus" "vore" "order" "conservation" "sleep_total" "sleep_rem" " sleep_cycle" "清醒" "brainwt" "bodywt"
***
qplot(log(bodywt),sleep_total,data=msleep)+geom_smooth()
qplot(log(bodywt),sleep_total,data=msleep)+geom_smooth(method = "lm",se=F)
qplot(log(bodywt),sleep_total,data=msleep,color=vore)+geom_smooth(method = "lm",se=F)
qplot(log(bodywt),sleep_total,data=msleep)+geom_smooth(method = "lm",se=F)+facet_grid(.~vore)
你可以使用ggplot
喜欢
library(ggplot2)
ggplot(msleep, aes(x = log(bodywt), y= sleep_total))+
geom_point()+
geom_smooth(method = "lm",se=F)+facet_grid(.~vore, scales = "free")
没有刻面
ggplot(msleep, aes(x = log(bodywt), y= sleep_total, color=vore))+
geom_point()+
geom_smooth(method = "lm",se=F)
请帮助和评论。
使用数据集 msleep,针对 bodywt 和 sleep_total 因素绘制 qplot,并使用 geo_smooth 添加一条线。 使用 qplot 绘制一条线,应用线性回归模型去除标准误差。 按沃尔分组。 将模型分成多面体。
names(msleep):"name" "genus" "vore" "order" "conservation" "sleep_total" "sleep_rem" " sleep_cycle" "清醒" "brainwt" "bodywt"
***
qplot(log(bodywt),sleep_total,data=msleep)+geom_smooth()
qplot(log(bodywt),sleep_total,data=msleep)+geom_smooth(method = "lm",se=F)
qplot(log(bodywt),sleep_total,data=msleep,color=vore)+geom_smooth(method = "lm",se=F)
qplot(log(bodywt),sleep_total,data=msleep)+geom_smooth(method = "lm",se=F)+facet_grid(.~vore)
你可以使用ggplot
喜欢
library(ggplot2)
ggplot(msleep, aes(x = log(bodywt), y= sleep_total))+
geom_point()+
geom_smooth(method = "lm",se=F)+facet_grid(.~vore, scales = "free")
ggplot(msleep, aes(x = log(bodywt), y= sleep_total, color=vore))+
geom_point()+
geom_smooth(method = "lm",se=F)