3
$\begingroup$

I've made a 3D plot of a pressure surface over the region 160W-20W, 20N-80N - the right panel 3D plot of a pressure surface over the region 160W-20W, 20N-80N - the right panel and I would like to put a map under it, probably just continental outlines for simplicity. I'm just updating to Mathematica 10. The plot on the left was made with other software and is just included to show the geographic domain. The plot on the right was made with:

ListPlot3D[data, Mesh -> False, BoxRatios -> {0.8*140, 60, 20}, ViewPoint -> Front, ColorFunction -> ColorData["Rainbow"]]

Thanks!

$\endgroup$
2
$\begingroup$

Also:

g1 = {EdgeForm@Black,LightGray,Opacity@.1, CountryData[#, "Polygon"]&/@ CountryData["SouthAmerica"]};
DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, ColorFunction -> "SunsetColors", Frame -> None, 
           Epilog -> Inset@Graphics@g1]

Mathematica graphics

Answering your request, using your latitude and longitude:

coords = List @@ CountryData["World", "FullPolygon"];
c1 = Map[Select[#, -160 < #[[1]] < -20 && 20 < #[[2]] < 80 &] &, coords, {2}];
g1 = Graphics[{Line /@ c1, Opacity[.1], Rectangle @@ {{-160, 20}, {-20, 80}}}, PlotRangePadding -> None]
ar = AspectRatio /. AbsoluteOptions[g1, AspectRatio][[1]];

DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, Frame -> None, 
 Epilog -> Inset[g1, Center, Center, Scaled[1]], AspectRatio -> ar, 
 PlotRangePadding -> None]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thanks, that's the sort of thing I'm looking for - but I'd like to be able to specify the range in terms of latitude and longitude. $\endgroup$ – Matt Feb 21 '15 at 14:03
  • $\begingroup$ @Matt See edit please $\endgroup$ – Dr. belisarius Feb 21 '15 at 16:06
1
$\begingroup$

Assuming your map is a ContourPlot[] and your geopotential thing is a Plot3D[]. I think something like the following example could work:

one = ContourPlot[Sin[x] Sin[y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, ContourShading -> None]
two = DensityPlot[Sin[x] Sin[y], {x, 0, 2 Pi}, {y, 0, 2 Pi}]
Show[{two,one}]

If your data for the pressure/geopotential is a list then use ListDensityPlot[] in step two. So long as your plots are both 2D, which should be doable I think a simple usage of the Show[] function will do the trick.

(*Output of the above code*)

enter image description here

$\endgroup$
  • $\begingroup$ Thanks for the reply. I'm using ListPlot3D and I'd like to add a geographical map in the background over the range 160W-20W, 20N-80N. $\endgroup$ – Matt Feb 21 '15 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.