Adding a Map on the XY-plane of a 3D plot.
A map can be added to the XY-plane of a 3D plot by capturing an image of the map from the MAP() function and then over-plotting the image on that plane of the 3D space.
Anonym
The following example code shows how to add a map to one of the planes of a 3D plot. The idea behind this procedure was to be able to use the 3D plot space to add data that corresponds to a location on the map, but in the Z direction.
The code is as follow:
pro map_3dprojection
scale=4
nlat=360*scale
nlon=180*scale
m = map('Equirectangular', /test, /device, margin=0.0, ASPECT_RATIO=nlon/nlat, dimensions=[nlat,nlon], /buffer)
w = m.window
img = w.CopyWindow()
; Create some data.
t = FINDGEN(4001) / 100
x = COS(t) * (1 + t / 10)
y = SIN(t) * (1 + t / 10)
z = SIN(2 * t)
xf=nlat/max(x)
yf=nlon/max(y)
p = plot3D(x*xf, y*yf, z, XRANGE=[0, nlat], YRANGE=[0, nlon], ZRANGE=[0,1], THICK=2, COLOR='red', $
XTICKLAYOUT=1, YTICKLAYOUT=1, $
XTICKname=[''], YTICKname=[''], $
AXIS_STYLE=1, XY_SHADOW=1, clip=0)
i = image(img, /overplot)
end
Code Description
1- First creates a map with dimensions control by the variable "scale". The idea is to make the map as big as possible so that when it's projected on to the X-Y plan it will have a good line and image resolution.
2- Them we create a window object so that we can use the CopyWindow() method to copy the content of the window where the map was drawn. I.e.:
w = m.window
img = w.CopyWindow()
3- Create some data to be used with the PLOT3D() function.
4- Overplot the image created in step 2) using the IMAGE() function.
This example produces the following output plot:
