简体   繁体   English

3D kernel 密度 plot 在 R

[英]3D kernel density plot in R

I have differences between hourly temperature and average temperature data from 1991 to 2021. I would like to plot 3D plot with ksdensity.从 1991 年到 2021 年,每小时温度和平均温度数据之间存在差异。我想用 ksdensity 来 plot 3D plot。 Suppose that x= axis of year, y = axis of temperatrue differences from mean temperature, z= densities.假设 x = 年轴,y = 与平均温度的温差轴,z = 密度。 How to generate a 3D kernel density plot?如何生成 3D kernel 密度 plot? Here is the code of plot 2D kernel density.这里是 plot 2D kernel 密度的代码。

Here is the temperature data.这是温度数据。

https://docs.google.com/spreadsheets/d/1W8jzfqXxxHsWf1J6uZ_C7BqvOBcx8rXL/edit?usp=sharing&ouid=111186166036061320361&rtpof=true&sd=true https://docs.google.com/spreadsheets/d/1W8jzfqXxxHsWf1J6uZ_C7BqvOBcx8rXL/edit?usp=sharing&ouid=111186166036061320361&rtpof=true&sd=true

Try persp:试试看:

x <- rnorm(1000)
y <- 2 + x*rnorm(1000,1,.1) + rnorm(1000)
library(MASS)
den3d <- kde2d(x, y)
persp(den3d, box=FALSE)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM