r - add flat polygon to rasterVis -



r - add flat polygon to rasterVis -

i create figure combines 3d bathymetric grided info (sea) 2d polygon (land).

for example, in such plot (http://chenangliu.info/en/wp-content/uploads/2014/02/wireframe.jpg) add together flat surface violet area, points, text,...

i noticed bundle rastervis, draws bathymetry raster. however, don't know how perchance add together land, regular 2d polygon. tried working around problem setting grid values land area zero, result not perfect because boundaries unsharp, there lakes,... should shouldn't in 3d.

so works fine:

library(rastervis) pal<-colorramppalette(c("darkblue","lightblue","green")) #----this doesn't help bathy[bathy>0,]=0 #---- plot3d(bathy,col=pal)

this doesn't:

polygon3d(europa) # error: error: n > 2 not true

the lastly function doesn't work [idem polygon() ], other attempts this. suppose isn't hard do, can't finy examples of this. hints welcome.

you have utilize polygon3d according specifications. since not provide info reproduce code, utilize illustration help page of plot3d:

library(raster) library(rastervis) library(rgl) data(volcano) r <- raster(volcano) extent(r) <- c(0, 610, 0, 870) plot3d(r)

now can add together 3d polygon functions defined in bundle rgl:

x <- c(30, 400, 400, 30) y <- c(30, 30, 500, 500) polygon3d(x, y, z=rep(100, 4), col = 'red') polygon3d(x, y, z=rep(120, 4), col = 'blue') polygon3d(x, y, z=rep(140, 4), col = 'black')

r 3d raster

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -