4
$\begingroup$

Bug introduced in 12.2.0 and persisting through 13.1


I have selected the following minimal example from the documentation. I am running v12.2.0 Win7-x64.

GeoRegionValuePlot[
 EntityClass["Country", "SouthAmerica"] -> "MerchantShips"]

enter image description here

Question: How do I put a GeoScaleBar on this plot in the lower right corner?

Thanks for your help in advance.

$\endgroup$
2
  • $\begingroup$ GeoRegionValuePlot[EntityClass["Country", "SouthAmerica"] -> "MerchantShips", PlotLegends -> Placed[Automatic, {.9, .2}]] $\endgroup$
    – Bob Hanlon
    Aug 30, 2022 at 13:07
  • $\begingroup$ Thanks @BobHanlon . GeoGraphics[Polygon[EntityClass["Country", "SouthAmerica"]], GeoScaleBar -> {"Imperial", "Metric"}]. I cannot figure out how to combine this scale with the GeoRegionValuePlot. $\endgroup$
    – Syed
    Aug 30, 2022 at 13:43

2 Answers 2

2
$\begingroup$

Using GeoScaleBar with GeoRegionValuePlot works with v12.0 or v12.1.1 but appears to have broken starting with v12.2 and continuing through v13.1

$Version

(* "12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)" *)

Clear["Global`*"]

grvp = GeoRegionValuePlot[
  EntityClass["Country", "SouthAmerica"] -> "MerchantShips", 
  GeoScaleBar -> Placed[{"Imperial", "Metric"}, {.55, .1}]]

enter image description here

$Version

(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)

Clear["Global`*"]

grvp = GeoRegionValuePlot[
  EntityClass["Country", "SouthAmerica"] -> "MerchantShips", 
  GeoScaleBar -> Placed[{"Imperial", "Metric"}, {.55, .1}]]

enter image description here

$\endgroup$
3
$\begingroup$

I am not sure why it doesn't work in the "obvious" way, i.e. by just adding the GeoScaleBar option to GeoRegionValuePlot, but it can be accomplished using Show after the fact:

Show[
  GeoRegionValuePlot[EntityClass["Country", "SouthAmerica"] -> "MerchantShips"],
  GeoScaleBar -> Placed[{"Imperial", "Metric"}, {Right, Bottom}]
]

plot with legend and placed scale bar

I feel that the obvious solution should work though, and this should be reported to Wolfram support.

$\endgroup$
4
  • $\begingroup$ On v12.2.0 Win 7-x64 (that I am using) the Show method results in a black filled polygon for the entire continent. Thanks for the answer. $\endgroup$
    – Syed
    Aug 30, 2022 at 14:48
  • $\begingroup$ @Syed That is odd! I am on v.12.3.1 on Win10-64 and the above works for me. I noticed that your GeoRegionValuePlot expression returns a Legended expression. Perhaps you could try to extract the GeoGraphics object from it (First@GeoRegionValuePlot[..]) and apply the Show to that, to see if it makes a difference? You could always tack on the legend afterwards. Not ideal, but maybe a workaround. $\endgroup$
    – MarcoB
    Aug 30, 2022 at 16:13
  • $\begingroup$ I don't have a Win version but try ReplacePart[grvp = GeoRegionValuePlot[EntityClass["Country", "SouthAmerica"] -> "MerchantShips"], 1 -> Show[grvp[[1]], GeoScaleBar -> Placed[{"Imperial", "Metric"}, {Right, Bottom}]]] $\endgroup$
    – Bob Hanlon
    Aug 30, 2022 at 16:29
  • $\begingroup$ If I use PlotLegends->None in the two preceding scenarios above this comment then the country colors are restored, but the GeoScaleBar still does not appear. $\endgroup$
    – Syed
    Aug 30, 2022 at 16:41

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.