[R] Plotting a functional time series
Eduardo de Oliveira Horta
eduardo.oliveirahorta at gmail.com
Tue Feb 22 03:18:49 CET 2011
Hello,
I'm willing to plot a sequence of densities on a 3d graph, something like
-----------------------------------------------------------------
x <- sapply(1:10, function(i)rnorm(1000))
f <- sapply(1:10, function(i)density(x[,i], from=-5,to=5)$y)
grid <- density(x[,1], from=-5,to=5)$x
win.graph()
persp(grid1, 1:10, f,theta=-50, phi=30, d=2)
-----------------------------------------------------------------
That is, I simply want to stack the curves
-----------------------------------------------------------------
win.graph()
opar <- par(mfrow=c(5,2), mar=c(2,2,1,1))
sapply(1:10, function(i)plot(grid, f[,i], ann=FALSE, type="l"))
par(opar)
-----------------------------------------------------------------
into a functional time series plot (unlike the example above, I'm
working with pdf's which are not independent).
The result I get using persp() is 'almost' what I want, but I would
like to avoid the wireframes connecting the densities along 1:10,
because there's no continuity in that direction. In other words, I
wanted that the only lines appearing in the plot to be those
corresponding to the pdf's f[,1],...f[,10].
Thanks once again, and best regards,
Eduardo
> sessionInfo()
R version 2.11.1 (2010-05-31)
i386-pc-mingw32
locale:
[1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgl_0.92.798 Revobase_4.2.0 RevoScaleR_1.1-1 lattice_0.19-13
loaded via a namespace (and not attached):
[1] grid_2.11.1 pkgXMLBuilder_1.0 revoIpe_1.0 tools_2.11.1
[5] XML_3.1-0
More information about the R-help
mailing list