在轴persp使用日期日期、persp

2023-09-07 23:45:41 作者:顾念笙

我想绘制上的persp情节x轴的日期,但无法找到这样做的一种方式。这是我在:

  X<  - 序列(-10,10,长度= 30)
X0<  -  as.Date(2000-01-01)
x.dates&所述;  - 以次(X0,X0 +长度(x)的-1,1)
Y'LT;  -  X
F<  - 函数(X,Y){为r  - 开方(X ^ 2 + Y ^ 2); 10 *罪(R)/ R}
z,其中, - 外(X,Y,F)
Z [is.na(Z)]<  -  1
OP<  - 面值(BG =白)
persp(x.dates,Y,Z,THETA = 30,披= 30,扩大= 0.5,列=浅蓝色,滚动类型=细)
 

解决方案

下面是一个方法来绘制透视图,日期(由杰夫·赖安):

又一波滑动轴图来袭 时间滑动轴 自定义滑动轴图

http://www.quantmod.com/examples/chartSeries3d/

阿尔法code为上图是在下面的网址。这是R code进行下载,所以我故意省略了HTTP的东西:

www.quantmod.com/examples/chartSeries3d/chartSeries3d.alpha.R

如果你看一下code,你可以看到他是如何做到的。

I'm trying to plot the dates on the x-axis of a persp plot, but cannot find a way of doing so. This is where I am at:

x <- seq(-10, 10, length= 30)
x0 <- as.Date("2000-01-01")
x.dates <- seq(x0,x0+length(x)-1,1)
y <- x
f <- function(x,y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r }
z <- outer(x, y, f)
z[is.na(z)] <- 1
op <- par(bg = "white")
persp(x.dates, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue",ticktype="detailed")

解决方案

Here's a way to plot perspective with dates (by Jeff Ryan):

http://www.quantmod.com/examples/chartSeries3d/

The alpha code for the above graph is at the following url. This is a DOWNLOAD of R code, so I purposely omitted the http stuff:

www.quantmod.com/examples/chartSeries3d/chartSeries3d.alpha.R

If you look at the code, you can see how he did it.