10
$\begingroup$

I try to use GeoListPlot to draw some points on a map. According to the manual, PlotMarkers -> {Automatic,s} should plot the points using the default point markers at size s, but this does not work. Also setting PlotMarkers -> None and Joined -> True still does show the default point markers on the line connecting the points - e.g.

GeoListPlot[GeoPosition /@ Table[{i, i}, {i, 20, 30}], 
 PlotMarkers -> None, Joined -> True]

Do I make here a syntax error or is this a bug?

$\endgroup$
2
  • $\begingroup$ Do you want to get rid of the PlotMarkers from your image? $\endgroup$ Aug 15, 2016 at 13:37
  • 1
    $\begingroup$ Use an empty string: GeoListPlot[GeoPosition /@ Table[{i, i}, {i, 20, 30}], PlotMarkers -> "", Joined -> True] $\endgroup$
    – Bob Hanlon
    Aug 15, 2016 at 16:24

3 Answers 3

7
$\begingroup$

This should illustrate how different settings for PlotMarkers are interpreted by GeoListPlot:

GeoListPlot[{{Entity[
      "AdministrativeDivision", {"Maine", "UnitedStates"}], 
     Entity["Mountain", "MountRushmore"]}, {Entity["Country", 
      "Mexico"], 
     Entity["City", {"Seattle", "Washington", "UnitedStates"}]}}, 
   Joined -> True, PlotMarkers -> #] & /@ {Automatic, None, {} &, ""}

enter image description here

In the last two examples, I'm using the excellent suggestions by Bob Hanlon and Mr. Wizard for turning off the markers altogether. You can see how they both interact with the legend.

When you use PlotMarkers -> None you are doing two things: turning off any polygon shading for the given geographic entity, and opting not to use a different shape marker for each list.

The setting PlotMarkers -> {g,s} where g is a graphic and s is a size, is listed in the documentation for PlotMarkers, not for GeoListPLot. You can test it to see that it does work for ListPlot and ListLinePlot.

If you wish to use a custom plot marker, then you can do something like this, but notice that it breaks the legend,

GeoListPlot[{{Entity[
    "AdministrativeDivision", {"Maine", "UnitedStates"}], 
   Entity["Mountain", "MountRushmore"]}, {Entity["Country", "Mexico"],
    Entity["City", {"Seattle", "Washington", "UnitedStates"}]}}, 
 Joined -> True, 
 PlotMarkers -> {Graphics[{Red, Disk[{0, 0}, Scaled[.02]]}], 
   Graphics[{Green, Disk[{0, 0}, Scaled[.08]]}]}]

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ Did you intend to write see below that PlotMarkers -> None has no effect or are you alluding to a different problem? $\endgroup$
    – Mr.Wizard
    Aug 16, 2016 at 6:23
  • $\begingroup$ I did intend it - the example shows that PlotMarkers -> None is the same as PlotMarkers -> Automatic $\endgroup$
    – Jason B.
    Aug 16, 2016 at 13:12
4
$\begingroup$

A bit of experimentation shows that the value of PlotMarkers may also be a Function:

GeoListPlot[
 GeoPosition /@ Table[{i, i}, {i, 20, 30}]
 , PlotMarkers -> (Print[#] &)
 , Joined -> True
]
GeoPosition[{20,20}]  
GeoPosition[{20,20}]  
GeoPosition[{21,21}]  
GeoPosition[{21,21}]  
GeoPosition[{22,22}]

...

Therefore a solution that actually eliminates the markers rather than making them transparent or small is to use PlotMarkers -> ({} &) or even PlotMarkers -> (##&[] &)(see How to avoid returning a Null if there is no "else" condition in an If contruct):

GeoListPlot[
 GeoPosition /@ Table[{i, i}, {i, 20, 30}]
 , PlotMarkers -> ({} &)
 , Joined -> True
]

enter image description here

$\endgroup$
1
  • $\begingroup$ +1 - It would be interesting to use those function slots to allow custom graphics objects as the plot markers. $\endgroup$
    – Jason B.
    Aug 16, 2016 at 14:11
3
$\begingroup$

I think its a bug. I personally would use JasonB's solution.

But here is some other stuff. You could modify your Table to only two points

GeoListPlot[GeoPosition /@ Table[{i, i}, {i, 20, 30, 10}], 
Joined -> True]

or you could use PlotStyle to increase the thickness of your line to cover the markers.

GeoListPlot[GeoPosition /@ Table[{i, i}, {i, 20, 30}], 
  PlotStyle -> Directive[Thickness[.04]], Joined -> True]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ +1 - I am just boggled that they include an example in the documentation that doesn't do anything. $\endgroup$
    – Jason B.
    Aug 15, 2016 at 14:07

Your Answer

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

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