R wireframe()使用晶格的颜色栏错误

R wireframe()使用晶格的颜色栏错误,r,lattice,R,Lattice,我尝试使用线框()和晶格 色条是错误的 require(marmap) require(lattice) Bathy2 <- getNOAA.bathy(lon1 = 30, lon2 = 47, lat1 = -12, lat2 = -28, resolution = 2) #plot of the area + transect plot(Bathy2, image=TRUE, land =

我尝试使用
线框()
晶格

色条是错误的

  require(marmap)
  require(lattice) 

     Bathy2 <- getNOAA.bathy(lon1 = 30, lon2 = 47,
                               lat1 = -12, lat2 = -28, resolution = 2)
#plot of the area + transect
     plot(Bathy2, image=TRUE, land = TRUE, lwd = 0.03,
             bpal = list(c(0,max(Bathy2), greys), c(min(Bathy2), 0, blues)))
     belt3 <- get.box(Bathy2, x1 = 34, x2 = 46, y1 = -20, y2 =  -20, width = 3, col = "red")

#3Dplot of the transect
       wireframe(belt3, shade = T, zoom = 1.1,
                  aspect = c(1/4, 0.1),
                  screen = list(z = -60, x = -55),
                  par.settings = list(axis.line = list(col = "white")),
                  par.box = c(col =rgb(0, 0, 0, 0.1)),
                  xlab="", colorkey = TRUE)
require(marmap)
需要(格子)
Bathy2As,带
shade=TRUE

相同的Z值可以有不同的颜色,具体取决于 面相对于观察方向和方向的方向 光源。因此,颜色键没有意义

因此,我建议改用
drape=TRUE

# 3Dplot of the transect
wireframe(belt3, drape = TRUE, zoom = 1.1,
          aspect = c(1/4, 0.1),
          screen = list(z = -60, x = -55),
          par.settings = list(axis.line = list(col = "white")),
          par.box = c(col =rgb(0, 0, 0, 0.1)),
          xlab="", colorkey = TRUE, lwd = 0.2)

您还可以定义自己的调色板。只需检查
?线框