Message Boards Message Boards

1
|
4689 Views
|
7 Replies
|
4 Total Likes
View groups...
Share
Share this post:

[?] Convert elements into entities?

Posted 4 years ago

Dear community, I want to convert the following list into entities so I can use GeoListPlot to visualise them.

In = CountryAll = CountryName // Union
Out = {"Albania", "AntiguaBarbuda", "Argentina", "Armenia", "Aruba", 
  "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", 
  "Barbados", "Belarus", "Belgium", "Belize", "BosniaHerzegovina", 
  "Brazil", "Bulgaria", "Canada", "CapeVerde", "Chile", "Colombia", 
  "CostaRica", "Croatia", "Cuba", "Cyprus", "CzechRepublic", 
  "Denmark", "Dominica", "Ecuador", "ElSalvador", "Estonia", "Fiji", 
  "Finland", "France", "Georgia", "Germany", "Greece", "Grenada", 
  "Guatemala", "Guyana", "Hungary", "Iceland", "Ireland", "Israel", 
  "Italy", "Jamaica", "Japan", "Kazakhstan", "Kiribati", "Kuwait", 
  "Kyrgyzstan", "Latvia", "Lithuania", "Luxembourg", "Macau", 
  "Maldives", "Malta", "Mauritius", "Mexico", "Montenegro", 
  "Netherlands", "NewZealand", "Nicaragua", "Norway", "Oman", 
  "Panama", "Paraguay", "Philippines", "Poland", "Portugal", 
  "PuertoRico", "Qatar", "Romania", "Russia", "SaintKittsNevis", 
  "SaintLucia", "SaintVincentGrenadines", "SanMarino", "Serbia", 
  "Seychelles", "Singapore", "Slovakia", "Slovenia", "SouthAfrica", 
  "SouthKorea", "Spain", "SriLanka", "Suriname", "Sweden", 
  "Switzerland", "Thailand", "TrinidadTobago", "Turkey", 
  "Turkmenistan", "Ukraine", "UnitedArabEmirates", "UnitedKingdom", 
  "UnitedStates", "Uruguay", "Uzbekistan"}

I don't know how to do it. Could you please tell me the command.

Thank you very much!

POSTED BY: Tester Trying
7 Replies
Posted 4 years ago

Additionally I have problems setting up a headline for the GeoListPlot.

GeoListPlot[CN, 
 GeoLabels -> (Tooltip[#1, #2] &, 
   PlotLabel -> 
    Style["Participating Countries", 25, Black,
      Bold])]

Could you also tell me a solution for this? Thanks a lot!

POSTED BY: Tester Trying
Posted 4 years ago

Looks like the parenthesis are not correct. Try

GeoListPlot[CN,
 GeoLabels -> (Tooltip[#1, #2] &),
 PlotLabel -> Style["Participating Countries", 25, Black, Bold]]
POSTED BY: Rohit Namjoshi
Posted 4 years ago

@Jason Biggs and @Rohit Namjoshi
Thank you so much! Have a great weekend.

POSTED BY: Tester Trying
Posted 4 years ago

Thank you to both of you. It worked!

Could you also tell me how to plot the map European centred?

POSTED BY: Tester Trying
Posted 4 years ago

Use the GeoCenter option.

europeCenter = Entity["GeographicRegion", "Europe"]["CenterCoordinates"]
GeoListPlot[countryEntities,
 ImageSize -> Large,
 GeoLabels -> (Tooltip[#1, #2] &),
 PlotLabel -> Style["Participating Countries", 25, Black, Bold],
 GeoCenter -> europeCenter]

You might also want to experiment with different GeoProjection.

POSTED BY: Rohit Namjoshi
Posted 4 years ago

Hi Tester

countryNames = {"Albania", "AntiguaBarbuda", "Argentina", "Armenia", 
  "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain",
   "Barbados", "Belarus", "Belgium", "Belize", "BosniaHerzegovina", 
  "Brazil", "Bulgaria", "Canada", "CapeVerde", "Chile", "Colombia", 
  "CostaRica", "Croatia", "Cuba", "Cyprus", "CzechRepublic", 
  "Denmark", "Dominica", "Ecuador", "ElSalvador", "Estonia", "Fiji", 
  "Finland", "France", "Georgia", "Germany", "Greece", "Grenada", 
  "Guatemala", "Guyana", "Hungary", "Iceland", "Ireland", "Israel", 
  "Italy", "Jamaica", "Japan", "Kazakhstan", "Kiribati", "Kuwait", 
  "Kyrgyzstan", "Latvia", "Lithuania", "Luxembourg", "Macau", 
  "Maldives", "Malta", "Mauritius", "Mexico", "Montenegro", 
  "Netherlands", "NewZealand", "Nicaragua", "Norway", "Oman", 
  "Panama", "Paraguay", "Philippines", "Poland", "Portugal", 
  "PuertoRico", "Qatar", "Romania", "Russia", "SaintKittsNevis", 
  "SaintLucia", "SaintVincentGrenadines", "SanMarino", "Serbia", 
  "Seychelles", "Singapore", "Slovakia", "Slovenia", "SouthAfrica", 
  "SouthKorea", "Spain", "SriLanka", "Suriname", "Sweden", 
  "Switzerland", "Thailand", "TrinidadTobago", "Turkey", 
  "Turkmenistan", "Ukraine", "UnitedArabEmirates", "UnitedKingdom", 
  "UnitedStates", "Uruguay", "Uzbekistan"};
countryEntities = Entity["Country", #] & /@ countryNames;

GeoListPlot[countryEntities, ImageSize -> Large, GeoLabels -> (Tooltip[#1, #2] &)]

enter image description here

POSTED BY: Rohit Namjoshi

Use Interpreter:

IIn[92]:= Interpreter["Country"][{"Albania", "AntiguaBarbuda", 
  "Argentina", "brazil"}]

Out[92]= {Entity["Country", "Albania"], 
 Entity["Country", "AntiguaBarbuda"], Entity["Country", "Argentina"], 
 Entity["Country", "Brazil"]}
POSTED BY: Jason Biggs
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract