Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How can I change the Longitude range to 0-360 in the such plots?

Graphics[{GrayLevel[0.2],AbsoluteThickness[1.5],
  CountryData[
    "World", {"SchematicPolygon",{"Equirectangular",{0,180}}}
  ]/.Polygon->Line},
  Frame->True,ImageSize->200]

World map

Thanks

share|improve this question
    
I don't think longitude goes above +/- 180, though... –  cormullion Jan 21 '13 at 12:18
1  
@cormullion Among many examples of longitude extending beyond the $[-180,180]$ range, NASA's recent Cassini mission mapped Titan between 0 and 360 degrees longitude. In principle there's no limit to longitude; for instance, to describe a spiraling track around the earth, one might prefer to use as many multiples of 360 degrees as there are windings of the spiral (in order to maintain a local continuity of the longitude coordinate). –  whuber Jan 21 '13 at 17:14
1  
@whuber well, I learn something every day! –  cormullion Jan 21 '13 at 17:18
    
It is common to use longitude between 0 and 360 in climate science (although 180W-180E is more common). In Mathematica, the command Longitude is also defined between -180 and 360. –  Karami Jan 22 '13 at 9:08

1 Answer 1

Simply like this:

map = Graphics[{GrayLevel[0.2], AbsoluteThickness[1.5], 
    CountryData[
      "World", {"SchematicPolygon", {"Equirectangular", {0, 
         180}}}] /. Polygon -> Line}, Frame -> True];

Show[map, 
 FrameTicks -> {{Automatic, 
    None}, {Transpose[{Range[13]*30 - 210, Range[13]*30 - 30}], 
    None}}, ImageSize -> 400]

enter image description here

Show[map, 
 FrameTicks -> {{Automatic, 
    None}, {Transpose[{Range[13]*30 - 210, 
      RotateLeft[Range[13]*30 - 30, 7] /. x_ /; x > 180 :> x - 30}], 
    None}}, ImageSize -> 400]

enter image description here

Addendum

In answer to comment:-

map = Graphics[{GrayLevel[0.2], AbsoluteThickness[1.5], 
    CountryData[
      "World", {"SchematicPolygon", {"Equirectangular", {0, 
         180}}}] /. Polygon -> Line}, Frame -> True];

linepos = First[Position[map, Line]];
line = Extract[map, Most[linepos]];
newline = line /. {a_Real, b_} :> {a + 180, b};
map2 = ReplacePart[map, Most[linepos] -> newline];

p2 = ListContourPlot[
   Table[Sin[i + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}], 
   Contours -> 15, ColorFunction -> "Rainbow", AspectRatio -> 1/2, 
   DataRange -> {{0, 360}, {-90, 90}}];

Show[p2, map2, ImageSize -> 400]

enter image description here

share|improve this answer
    
Thanks a lot. It was a great help. –  Karami Jan 21 '13 at 13:16
    
Now I face with another problem.When I try the following, I do not get the two plots on each other with the newly defined range for longitude.For example: p2 = ListContourPlot[ Table[Sin[i + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}], Contours -> 15, ColorFunction -> "Rainbow", AspectRatio -> 1/2, DataRange -> {{0, 360}, {-90, 90}}] ; Show[p1, map, ImageSize -> 400, FrameTicks -> {{Automatic, None}, {Transpose[{Range[13]*30 - 210, Range[13]*30 - 30}], None}}, ImageSize -> 400] –  Karami Jan 21 '13 at 13:25
    
many thanks again –  Karami Jan 21 '13 at 14:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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