在轴persp使用日期 [英] Using dates on axis in persp

查看:145
本文介绍了在轴persp使用日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想绘制上的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.

这篇关于在轴persp使用日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆