2
$\begingroup$

I want to place labels on a geographic map. I can do this with individual points as in the code below

Show[
  CountryData["France", {"Shape", "Mercator"}], 
  Frame -> True, 
  Epilog -> 
    {PointSize[0.01], Red, Point[mercPoints], 
     Text[Abbeville, {3, 47}, 
       BaseStyle -> {FontWeight -> "Bold", FontSize -> 12}], 
     Text[Agen, {3, 50}]}]

But this is not my aim. I have a list containing the names I want to label the points with (say stationNames). How do I attach each of the label names in stationNames to its respective point given by mercPoints, which is the list giving the longitude and latitude of each point.

$\endgroup$
  • 1
    $\begingroup$ You might try some like MapThread[Text[#1, #2], {names, mercPoints}] $\endgroup$ – m_goldberg Oct 3 '16 at 2:16
  • $\begingroup$ Hi, your line of code returned an error when I tried it. 'An unknown box name (Text[#, #2]) was sent as the BoxForm for the expression. Check the format rules for the expression' $\endgroup$ – Tom6639 Oct 3 '16 at 2:45
  • 1
    $\begingroup$ Sorry. Left out &. Try MapThread[Text[#1, #2]&, {names, mercPoints}] $\endgroup$ – m_goldberg Oct 3 '16 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.