ggplot2提供的geom_histogram()用于绘制统计直方图
该函数有两个主要参数,binwidth(箱型3宽度)和bins(箱型数量)
ggplot2提供的geom_density()用于绘制估计的和密度图...,cosina,optcpsine.
1数据构造
统计直方图是对一个变量的统计,所以aex里面的参数是一个变量,不同于以往的x和y,这里我们对MXSPD进行统计
image.png
2绘制统计直方图
ggplot...(df, aes(x=MXSPD, fill=Location))+
geom_histogram(binwidth = 1,alpha=0.55,colour="black",size=0.25...(binwidth = 1,alpha=0.55,colour="black",size=0.25)+ #, aes(fill = ..count..) )
facet_grid(....legend.background = element_blank()
)
image.png
4绘制估计概率密度图
ggplot(df, aes(x=MXSPD, fill=Location))+
geom_density