10

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?

rcollyer
  • 33,976
  • 7
  • 92
  • 191
hippo3773
  • 1,246
  • 6
  • 10

3 Answers3

7

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

Jason B.
  • 68,381
  • 3
  • 139
  • 286
  • Did you intend to write see below that PlotMarkers -> None has no effect or are you alluding to a different problem? – Mr.Wizard Aug 16 '16 at 06:23
  • I did intend it - the example shows that PlotMarkers -> None is the same as PlotMarkers -> Automatic – Jason B. Aug 16 '16 at 13:12
4

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

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
  • +1 - It would be interesting to use those function slots to allow custom graphics objects as the plot markers. – Jason B. Aug 16 '16 at 14:11
3

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

Conor
  • 7,449
  • 1
  • 22
  • 46
  • 1
    +1 - I am just boggled that they include an example in the documentation that doesn't do anything. – Jason B. Aug 15 '16 at 14:07