7
$\begingroup$

How do you style the following:

GeoGraphics[{Red, Opacity[1], GeoDisk[{60, 20}]}, 
 GeoBackground -> None]

Pink Image

so that the resulting disk is exactly red? GeoCircle seems to work as expected, but not GeoDisk generates an underlying style with transparency, as does GeoBoundsRegion.

$\endgroup$

2 Answers 2

9
$\begingroup$

Use GeoStyling:

GeoGraphics[{GeoStyling[Red], GeoDisk[{60, 20}]}]

enter image description here

$\endgroup$
5
$\begingroup$

GeoGraphics uses a predefined opacity for GeoDisk primitives. Calling Opacity prior to the generation of the GeoDisk object will not change its value.

A possibility is to modify the opacity once the graphics is created:

graphics = GeoGraphics[{Red, GeoDisk[{60, 20}]}, GeoBackground -> None];

graphics /. Directive[Opacity[0.2`]] -> Directive[Opacity[1]]

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ (+1) Excellent explanation, but such implementation is inconsistent both with overall design of Graphics and with the Docs for GeoDisk where we read under Details and Options: "FaceForm, EdgeForm, and GeoStyling can be used to specify how the interiors and boundaries of geographic regions should be rendered." I understand why they have implemented it this way but I still would call this a wrong design decision or a bug. $\endgroup$ Commented Oct 22, 2016 at 19:30
  • $\begingroup$ @AlexeyPopkov Thanks. I agree, it would make sense and be consistent to be able to supersede the default opacity just by calling Opacity. $\endgroup$
    – user31159
    Commented Oct 22, 2016 at 19:38
  • 1
    $\begingroup$ Your (apparently hackish) workaround can be simplified to graphics /. Directive[Opacity[0.2`]] -> {}. The hackish nature of the solution is what makes me feeling that the design is wrong. They simply shouldn't include any hard-coded styling into basic primitives. $\endgroup$ Commented Oct 22, 2016 at 19:41
  • 1
    $\begingroup$ @AlexeyPopkov Ah yes, this is nicer. I would be concerned about having no default for the opacity of GeoDisk. It seems to be useful in the majority of cases, and the alternative of specifying each time the Opacity is perhaps not user-friendly. This being said, I agree it would be better not to "lock" this styling, and let the user be able to change it as for any other directive of any other primitive. $\endgroup$
    – user31159
    Commented Oct 22, 2016 at 20:09
  • 3
    $\begingroup$ In GeoGraphics maps there are two sets of primitives: the geo primitives, that should be understood as "painted" on the surface of the Earth, and the primitives, that are "painted" on the projected map. The latter follow the rules of Graphics (including the default opacity 1), and the former follow the geo rules (including the default opacity 0.2 to avoid covering the background maps). Both sets respond in the same way to bare directives, except for opacity, because defaults are different. The GeoStyling wrapper explicitly affects only the geo primitives. $\endgroup$
    – jose
    Commented Oct 23, 2016 at 13:40

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.