I need to build some 2d data in time (thus 3d)

I have an xts data object through time:

> head(vixData[,2:8], 5) F1 F2 F3 F4 F5 F6 F7 2009-06-08 30.25 32.00 31.70 31.75 31.65 30.85 29.95 2009-06-09 29.10 30.95 30.95 31.15 31.10 30.40 29.45 2009-06-10 29.10 31.20 31.30 31.45 31.50 30.75 29.95 2009-06-11 28.10 30.60 30.75 30.90 31.00 30.20 29.25 2009-06-12 28.35 29.95 30.10 30.45 30.50 29.90 29.05 

F1-F7 will form a curve as shown below:

 plot(1:7, vixData[399,2:8], type = 'o', pch = 6) 

enter image description here

I would like to do this with time. The lines of the xts object are the values ​​for each day that generate the curve. I want to create something like this:

enter image description here

I am trying to use plot3D and surf3D, but I can not understand the documentation or how to convert the dataframe to what surf3D wants. Any ideas or best package deals?

I tried using the :: wireframe grid, as suggested in the comments, but I get the following:

 curveData <- vixData[-(1:100),2:8, drop = FALSE] wireframe(t(as.matrix(curveData)), shade = TRUE, scales = list(arrows = FALSE), aspect = c(0.65, 0.25), drape = TRUE, zlab = "Level", xlab = "Contract", ylab = "Time", panel.aspect = .75) 

enter image description here

It looks pretty close! But - I hope that I can possibly rotate the image and expand it along the Time axis to give better clarity. Are there any options for this? I can not find it in the documentation.

+6
source share
2 answers

The chartSeries3d source file should help. You may also be interested in

 source("http://www.quantmod.com/examples/chartSeries3d/chartSeries3d.alpha.R") library("xts") data("sample_matrix") chartSeries3d0( as.xts( sample_matrix ), col=c("lightblue","blue")) 

TimeSeriesPlot

+3
source

Excel 3D Chart Diagram is the best option for you. even Excel 2007 has this graph. You can rotate the axis, easily change colors.

select sample volcano data

-1
source

Source: https://habr.com/ru/post/986752/


All Articles