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

2 Answers 2

2
$\begingroup$

Also:

g1 = {EdgeForm@Black,LightGray,[email protected], 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$
2
  • $\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, 2015 at 14:03
  • $\begingroup$ @Matt See edit please $\endgroup$ Feb 21, 2015 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$
1
  • $\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, 2015 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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