4
$\begingroup$
areas = {"Belize", "Guatemala", "Honduras", "Haiti", 
   "Saint Kitts and Nevis", "Saint Lucia", 
   "Saint Vincent and the Grenadines", "Paraguay", "Marshall Islands",
    "Nauru", "Palau", "Tuvalu", "Eswatini", "Vatican"};

GeoListPlot[Callout[Entity["Country", #], #] & /@ areas]

output plot

I don't know why the label Paraguay or Marshall Islands appears in the wrong place. Did I miss something?

$\endgroup$

2 Answers 2

5
$\begingroup$

Your names are not the standard that Entity uses. However, you can use SemanticInterpration to turn "free form" text into entities, and it works for all of your data:

areaNames = {...all your names here...};
areaEntities = SemanticInterpretation /@ areaNames

Since you're using GeoListPlot, you can just set the GeoLabels option to true:

GeoListPlot[areaEntities, GeoLabels -> True]

On the other hand, if you want to use your original areaNames as labels, you might have to pair those names with the entities and apply Callout (somewhat similar to what you originally tried, but with pairs, i.e. two arguments):

GeoListPlot[Callout @@@ Transpose[{areaEntities, areaNames}]]
$\endgroup$
1
  • $\begingroup$ I note Interpreter["Country"][areaNames] always faster than SemanticInterpretation, and it has caching $\endgroup$
    – yode
    Commented Sep 23, 2022 at 3:05
3
$\begingroup$

With Callout

  1. Use names that the engine recognizes for the countries. Some assistance can be had from the free form linguistic input.
  2. Divide this task into three pictures to get readable outputs as these countries span a large part of the globe.

c1 = Entity["Country", #] & /@ {"Belize", "Guatemala", "Honduras", 
   "Haiti", "SaintKittsNevis", "SaintLucia", "SaintVincentGrenadines",
    "Paraguay"}
c2 = Entity["Country", #] & /@ {"Nauru", "Palau", "Tuvalu", 
   "MarshallIslands"}
c3 = Entity["Country", #] & /@ {"Swaziland", "VaticanCity"}

The following seems to work for {c1,c2,c3}:

GeoListPlot[Callout @@ Transpose[{#, #["Name"]}] & /@ c1]

GeoListPlot[
 Callout @@ Transpose[{#, #["Name"]}] & /@ Catenate[{c1, c2, c3}], 
 ImageSize -> Full, GeoRange -> "World", 
 GeoCenter -> Entity["City", {"Cairo", "Cairo", "Egypt"}]]

Another option

Use GeoLabels instead of Callout.

GraphicsRow[
 GeoListPlot[#, GeoLabels -> Automatic, ImageSize -> Large] & /@ {c1, 
   c2, c3}]

I will not upload the picture as it is 139kB.

$\endgroup$

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.