线框图未显示值

Wireframe plot not showing the values

我正在尝试完成此线框图,但由于某种原因它没有显示内容,仅显示了图的轮廓。下面是数据和MWE。

不合作()代码:

library(lattice)
wireframe(
  data = as.data.frame(a), ncpg12 ~ `S>B` * powg2,
  shade = T, aspect = c(1, 1.5, 2), scales = list(arrows = F)
)

数据为wire.csv:

ncpg12,powg2,S>B
9.248631177619243,0.5604918536931173,0.00183393456426873
6.982877749338513,0.3098192715335432,0.01213195467163962
4.701116657737657,0.04999999999999999,0.06639433627763273
5.910427426924798,0.24518128912337697,0.1450446478654616
7.100787486648187,0.410018053934651,0.18041044252588423
6.867220052256016,0.5604978615437913,0.01213195467163977
4.557178781889888,0.3098192714867842,0.03131615691038152
2.256382318979377,0.04999999999999999,0.10386777520189128
3.544175197270306,0.24518128913433623,0.1956947037363749
4.786247297051887,0.4100180539207875,0.23509889193262204
4.47444787576751,0.5604978615358123,0.0663943362776329
2.1492331205663504,0.30981927148918764,0.10386777520189153
0,0.04999999999999999,0.2119180786856567
1.6301662903351826,0.24518128914507187,0.3267560369666459
3.046468068832837,0.4100180539377091,0.37248269710500553
5.731804609367828,0.5604978615356425,0.1450446478654616
3.4916627620168583,0.30981927144570615,0.19569470373637557
1.691074359432605,0.04999999999999999,0.32675603696664685
3.791287623813332,0.24518128912628456,0.4532575404720525
5.415642812939041,0.4100180538993808,0.5011596926023434
6.959612008409749,0.5604978614989732,0.1804104425258848
4.773824852643884,0.30981927143543664,0.2350988919326221
3.149864586948752,0.04999999999999999,0.3724826971050044
5.458051219009576,0.24518128905784495,0.5011596926023425
7.169432426981075,0.4100180538979537,0.5490511783213748
13.743971562458682,0.8475275485721443,0.00146994891912016
9.18463317316673,0.5431311708382447,0.01136908005754479
4.701116657905004,0.04999999999999999,0.06570438744198948
7.351968961351304,0.43391556095132944,0.14532454892964627
9.852982274307578,0.6876116333369463,0.1811890044398896
11.388418467186057,0.8475300860646717,0.01098668767881793
6.766360203153454,0.5431311707908197,0.02979799221541907
2.256382319061231,0.04999999999999999,0.10249311714271682
5.022962834042119,0.4339155609593038,0.19531930144010193
7.600496760083843,0.6876116333470675,0.23521845207420533
8.942010973938523,0.8475300860612255,0.06292370525775945
4.296879777810318,0.5431311707936094,0.10016997191686286
0,0.04999999999999999,0.2086924088558675
3.259433943545446,0.4339155609421589,0.32472076124519667
6.08980889108534,0.6876116333444386,0.37097763013907503
10.033463255787863,0.8475300860611537,0.13933895061160378
5.50333769575991,0.5431311708127886,0.18999713514627453
1.691074359241611,0.04999999999999999,0.3220093974091579
5.616303463568329,0.43391556093219097,0.449989511559725
8.743466363001062,0.687611633342467,0.4984905017778514
11.174209234632144,0.8475300860623024,0.1739366597649558
6.717756648919021,0.5431311708061631,0.22874296954077433
3.149864587112461,0.04999999999999999,0.3672893695383088
7.367578939567466,0.4339155609391685,0.4975672654509311
10.617837423260426,0.6876116333328715,0.5460864990319658

这是我的做法。

dat <- read.csv(textConnection("'ncpg12','powg2','S>B', 
9.248631177619243,0.5604918536931173,0.00183393456426873
6.982877749338513,0.3098192715335432,0.01213195467163962
4.701116657737657,0.04999999999999999,0.06639433627763273
5.910427426924798,0.24518128912337697,0.1450446478654616
7.100787486648187,0.410018053934651,0.18041044252588423
6.867220052256016,0.5604978615437913,0.01213195467163977
4.557178781889888,0.3098192714867842,0.03131615691038152
2.256382318979377,0.04999999999999999,0.10386777520189128
3.544175197270306,0.24518128913433623,0.1956947037363749
4.786247297051887,0.4100180539207875,0.23509889193262204
4.47444787576751,0.5604978615358123,0.0663943362776329
2.1492331205663504,0.30981927148918764,0.10386777520189153
0,0.04999999999999999,0.2119180786856567
1.6301662903351826,0.24518128914507187,0.3267560369666459
3.046468068832837,0.4100180539377091,0.37248269710500553
5.731804609367828,0.5604978615356425,0.1450446478654616
3.4916627620168583,0.30981927144570615,0.19569470373637557
1.691074359432605,0.04999999999999999,0.32675603696664685
3.791287623813332,0.24518128912628456,0.4532575404720525
5.415642812939041,0.4100180538993808,0.5011596926023434
6.959612008409749,0.5604978614989732,0.1804104425258848
4.773824852643884,0.30981927143543664,0.2350988919326221
3.149864586948752,0.04999999999999999,0.3724826971050044
5.458051219009576,0.24518128905784495,0.5011596926023425
7.169432426981075,0.4100180538979537,0.5490511783213748
13.743971562458682,0.8475275485721443,0.00146994891912016
9.18463317316673,0.5431311708382447,0.01136908005754479
4.701116657905004,0.04999999999999999,0.06570438744198948
7.351968961351304,0.43391556095132944,0.14532454892964627
9.852982274307578,0.6876116333369463,0.1811890044398896
11.388418467186057,0.8475300860646717,0.01098668767881793
6.766360203153454,0.5431311707908197,0.02979799221541907
2.256382319061231,0.04999999999999999,0.10249311714271682
5.022962834042119,0.4339155609593038,0.19531930144010193
7.600496760083843,0.6876116333470675,0.23521845207420533
8.942010973938523,0.8475300860612255,0.06292370525775945
4.296879777810318,0.5431311707936094,0.10016997191686286
0,0.04999999999999999,0.2086924088558675
3.259433943545446,0.4339155609421589,0.32472076124519667
6.08980889108534,0.6876116333444386,0.37097763013907503
10.033463255787863,0.8475300860611537,0.13933895061160378
5.50333769575991,0.5431311708127886,0.18999713514627453
1.691074359241611,0.04999999999999999,0.3220093974091579
5.616303463568329,0.43391556093219097,0.449989511559725
8.743466363001062,0.687611633342467,0.4984905017778514
11.174209234632144,0.8475300860623024,0.1739366597649558
6.717756648919021,0.5431311708061631,0.22874296954077433
3.149864587112461,0.04999999999999999,0.3672893695383088
7.367578939567466,0.4339155609391685,0.4975672654509311
10.617837423260426,0.6876116333328715,0.5460864990319658"), header=TRUE)

names(dat) <- c("ncpg12", "powg2", "SB")
library(rgl)

s <- interp(dat$powg2, dat$SB, dat$ncpg12)

eg <- expand.grid(xind = 1:40, 
            yind = 1:40)

eg$powg2 <- s$x[eg$xind]
eg$SB <- s$y[eg$yind]
eg$ncpg12 <- c(s$z)



library(lattice)
wireframe(
  data = eg, 
  ncpg12 ~ SB * powg2,
  shade = T, aspect = c(1, 1.5, 2), scales = list(arrows = F)
)