Consider the following list of countries which I would like to highlight on a world map:


From the documentation center (Country Data > Applications > Application 5), I know that

Graphics[{If[CountryData[#, "AntarcticNations"], Orange, LightBrown], 
    CountryData[#, "SchematicPolygon"]} & /@ CountryData[]]

works for all antarctic nations. I replaced "AntarcticNations" by MyCountries but it does not seem to work.


3 Answers 3


In the example code, CountryData[#, "AntarcticNations"] is a built in predicate that returns True or False. You need something similar for your countries. Perhaps,

  CountryData[#,"SchematicPolygon"]}& /@ CountryData[]]

enter image description here

  • 2
    $\begingroup$ "Bosnia" is not recognized, should be "BosniaHerzegovina". $\endgroup$
    – VLC
    May 1, 2012 at 7:55
  • 1
    $\begingroup$ I'd like to add that CountryData[#, {"Polygon", "Mollweide"}] allows to set the projection used for the map. $\endgroup$
    – Karsten W.
    Jul 22, 2012 at 12:40

Alternate approach:

  {Orange, CountryData[#, "SchematicPolygon"] & /@ MyCountries}, 
      CountryData[#, "SchematicPolygon"] & /@ Complement[CountryData[], MyCountries]}

which draws all of "your countries" in one color, and then the rest of the world in another.


Mathematica 10 introduced new ways to highlight countries on the world map. Examples follow below. There are lots of more examples in the documentation which showcase alternative stylings.

myCountries = Map[
   Entity["Country", #] &,
   {"Germany", "Hungary", "Mexico", "Austria", "Turkey", "SouthKorea", "China"}

GeoListPlot[myCountries, ImageSize -> 800]

Map 1

GeoListPlot[myCountries, GeoBackground -> "ReliefMap", ImageSize -> 800]

Map 2

GeoRegionValuePlot[MapThread[Rule, {myCountries, RandomReal[10, Length@myCountries]}]]

Map 3

 {EdgeForm[Black], FaceForm[Orange], Polygon /@ myCountries},
 ImageSize -> 800

enter image description here


Your Answer

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

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