Contour sections on the surface of a sphere

I acquired some data at a fixed distance R for different theta (along the vertical axis) and phi (along the x axis) to get a three-dimensional representation of the quantity of interest. Please note that while phi covers 360 °, theta only covers 70 ° to 90 °.

I know how to create a 3D graph with the plot3D package (namely, the persp3D function) or a contour graph, but I would like to draw such contours over a sphere using information about theta and phi angles.

Could you point me to the corresponding online resource, where can I find a suitable solution?

Many thanks and good wishes

Nicola

+6
source share
1 answer

This is not just a 3d view (for example, in rgl ), but you might find it useful:

 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) 

enter image description here

+2
source

All Articles