在R中分层密度图而不使用密度()
我使用KernSmooth软件包计算并绘制了高斯核密度估计值,如下所示:在R中分层密度图而不使用密度(),r,ggplot2,lattice,kernel-density,R,Ggplot2,Lattice,Kernel Density,我使用KernSmooth软件包计算并绘制了高斯核密度估计值,如下所示: x <- MyData$MyNumericVector h <- dpik(x) est <- bkde(x, bandwidth=h) plot(est, type='l') x您可以使用geom\u-line: m <- ggplot(NULL, aes(x=bkde(movies$votes)$x,y=bkde(movies$votes)$y)) + geom_line() pr
x <- MyData$MyNumericVector
h <- dpik(x)
est <- bkde(x, bandwidth=h)
plot(est, type='l')
x您可以使用geom\u-line
:
m <- ggplot(NULL, aes(x=bkde(movies$votes)$x,y=bkde(movies$votes)$y)) + geom_line()
print(m)
m您可以使用geom\u-line
:
m <- ggplot(NULL, aes(x=bkde(movies$votes)$x,y=bkde(movies$votes)$y)) + geom_line()
print(m)
m对于那些感兴趣的人来说,下面是代码的结果:ggplot()+geom_线(aes(x=bkde(MyFirstDataframe$MyNumericVector,bandwidth=h)$x,y=bkde(MyFirstDataframe$MyNumericVector,bandwidth=h)$y))+geom_线(aes(x=bkde(mysecondataframe$MyNumericVector,bandwidth=h)$x,y=bkde)(MySecondDataframe$MyNumericVector,带宽=h)$y)
对于感兴趣的人,下面是代码的结果:ggplot()+geom_线(aes(x=bkde(MyFirstDataframe$MyNumericVector,带宽=h)$x,y=bkde(MyFirstDataframe$MyNumericVector,带宽=h)$y)+geom_线(aes(x=bkde(MySecondDataframe$MyNumericVector,带宽=h)$x,y=bkde(MySecondDataframe$MyNumericVector,带宽=h)$y))