r - Contour plots on a sphere surface -
i have acquired data @ fixed distance r , various theta (from vertical axis) , phi (from x axis) angles obtain 3d representation of quantity of interest. please note while phi spans 360°, theta spans 70° 90°.
i know how generate 3d plot plot3d package (namely, persp3d function) or contour plot, draw such contours on sphere using theta , phi angles information.
would please point me appropriate online resource can find suitable solution?
many , kind regards
nicola
this isn't 3d representation (e.g. in rgl
), maybe gets started:
library(maps) library(mapproj) library(akima) set.seed(11) n <- 500 x <- runif(n, min=-180,max=180) y <- runif(n, min=-90,max=90) z <- x^2+y^3 param <- null proj <- "orthographic" orient <- c(45,15,0) xlim <- c(-180, 180) ylim <- c(-90, 90) nlevels=20 pal <- colorramppalette( c("purple4", "blue", "cyan", "yellow", "red", "pink")) map("world", col=na, param=param, proj=proj, orient=orient, xlim=xlim, ylim=ylim) p <- mapproject(x,y) incl <- which(!is.na(p$x)) field <- interp(p$x[incl],p$y[incl],z[incl], xo=seq(min(p$x[incl]), max(p$x[incl]), length = 100), yo=seq(min(p$y[incl]), max(p$y[incl]), length = 100) ) image(field, add=true, col=pal(nlevels)) points(p$x, p$y, pch=".", cex=2, col=4) cont <- contour(field, add=true, n=nlevels, col="white") lines(sin(seq(0,2*pi,,100)), cos(seq(0,2*pi,,100)), lwd=3)
Comments
Post a Comment