r格子线框在特定条件下的不同颜色

时间:2012-03-22 18:05:32

标签: r lattice wireframe

我使用格子包中的wireframe以3D形式绘制数据,以显示波动率期限结构。这是数据:

library(lattice) 

con <- textConnection ("  X1M    X2M    X3M    X6M    X9M   X12M   X18M   X24M VSTOXX Euro.Stoxx.50
2006-04-14 14.850 15.076 15.462 15.950 16.396 16.700 17.146 17.968 15.068      3793.830
2006-04-21 16.468 15.028 15.476 15.900 16.342 16.858 17.402 18.030 14.930      3824.030
2006-04-28 14.576 15.070 14.560 15.552 15.996 16.262 16.850 17.630 14.810      3865.136
2006-05-05 14.806 14.990 14.770 15.584 16.132 16.378 16.868 17.668 14.906      3848.302
2006-05-12 15.944 14.968 14.734 15.260 15.840 15.582 16.496 17.338 15.028      3844.066
2006-05-19 27.708 18.316 17.466 17.250 17.412 17.478 17.796 17.646 19.204      3655.658
2006-05-26 23.756 20.862 19.650 19.922 19.348 19.256 19.362 19.330 22.732      3613.942
2006-06-02 23.172 21.504 20.720 21.046 20.332 20.188 20.054 20.404 22.078      3638.574
2006-06-09 24.972 22.898 22.366 22.416 21.448 21.204 20.788 21.146 23.168      3535.830
2006-06-16 28.138 24.660 23.888 23.330 22.604 22.010 21.850 22.248 25.150      3451.960
2006-06-23 21.114 20.606 20.256 19.898 19.820 19.954 20.350 21.168 21.194      3525.386
2006-06-30 20.722 20.188 19.884 19.566 19.360 19.438 19.808 20.088 20.508      3555.864
2006-07-07 18.348 18.380 18.574 18.702 18.552 19.038 19.374 19.806 18.370      3653.206
2006-07-14 21.944 19.834 19.922 19.660 19.606 19.740 20.096 20.332 19.960      3597.120
2006-07-21 24.876 21.276 21.160 20.654 20.536 20.746 21.008 21.330 21.224      3544.618
2006-07-28 18.506 18.696 18.642 19.106 19.332 19.806 20.248 20.644 18.606      3659.466
2006-08-04 18.718 18.934 18.914 19.282 19.292 19.714 20.080 20.470 18.878      3682.964
2006-08-11 20.586 19.798 19.534 19.666 19.504 19.736 20.154 20.570 19.878      3676.808
2006-08-18 19.258 17.696 18.112 18.452 18.628 19.080 19.698 20.068 17.566      3773.618
")
Dat<- read.table(con, header = TRUE)

我想在3D图中单独显示以下内容(单独):

1。)我可以通过

简单地控制我有不同颜色的关卡
data2<-Dat[,c(8,7,6,5,4,3,2,1)]

wireframe(as.matrix(data2),
          aspect = c(61/87, 0.4), drape = TRUE,
          scales = list(arrows = F, cex= 0.5, font = 1),
          xlab='Date', ylab='Maturity', zlab='Value',
col.regions=c("#FF3030","#551A8B","#43CD80"),
         at=c(0,18,25,30))

但是如何在平坦/陡峭/反向术语结构的时期内有不同的颜色?

2。)数据集实际上代表了2006-06-16之前和之后9周(或任何其他日期,而不是必须的9周时间跨度),我想通过不同颜色突出显示这个具体日期。 3D绘图或一些箭头/文本/...

谢谢,

亚历山大

0 个答案:

没有答案