5
$\begingroup$

I was surprised today when I discovered that GeoMarker seems to ignore the Opacity directive in GeoGraphics. This can be demonstrated using the first example in the documentation:

GeoGraphics[{GeoStyling["OutlineMap"], 
  Opacity[.5],
  Polygon[Entity["Country", "Italy"]], 
  GeoMarker[Entity["City", {"Rome", "Lazio", "Italy"}]]}]

wrong opacity

The country's polygon is respecting the Opacity directive, but GeoMarker ignores it.

How to properly set the opacity of GeoMarkers?

$\endgroup$

1 Answer 1

4
$\begingroup$

Probably the most simple way to set the opacity of GeoMarkers is with an undocumented usage of its "Color" parameter. It appears to support Directives, so the opacity can be set the following way:

GeoGraphics[{GeoStyling["OutlineMap"], Opacity[.5], 
  Polygon[Entity["Country", "Italy"]], 
  GeoMarker[Entity["City", {"Rome", "Lazio", "Italy"}], 
   "Color" -> Directive[Opacity[.5], RGBColor[0.790588, 0.201176, 0.]]]}]

correct opacity

$\endgroup$
6
  • $\begingroup$ Do you mind tell us how to find it? $\endgroup$
    – yode
    Commented Jun 18, 2016 at 16:22
  • 3
    $\begingroup$ @yode I had a hunch and was lucky it worked. :) $\endgroup$
    – shrx
    Commented Jun 18, 2016 at 16:30
  • 2
    $\begingroup$ "Color" is a documented option for GeoMarker $\endgroup$
    – Bob Hanlon
    Commented Jun 18, 2016 at 18:24
  • $\begingroup$ @BobHanlon Yes, but it doesn't mention it can take other arguments than color objects. $\endgroup$
    – shrx
    Commented Jun 18, 2016 at 18:38
  • 3
    $\begingroup$ [RGBColor] (reference.wolfram.com/language/ref/RGBColor.html) has an optional fourth argument for opacity. $\endgroup$
    – Bob Hanlon
    Commented Jun 18, 2016 at 20:03

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.