开发者

Using dates on axis in persp

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜