3
$\begingroup$

I'm making a basic 50-state map of population (using a log scale). Given the usual crucible of figuring out what to do with Hawaii and Alaska, I thought I would make the same GeoRegionValuePlot three times with the same dataset, and use GeoRange to center one each on the continental US, on AK, and on HI (thus keeping the color scales consistent), and arrange them with a GraphicsGrid.

This worked fine, except that the GeoRange of Alaska, at an ImageSize of 240, is {240, 150}, while Hawaii is {240, 157}:

contentinal = GeoRegionValuePlot[populationLog, GeoRange->Entity["Country","UnitedStates"], ImageSize->500, PlotLegends->None];
ak = GeoRegionValuePlot[populationLog, GeoRange->Entity["AdministrativeDivision",{"Alaska","UnitedStates"}], ImageSize->240, PlotLegends->None];
hi = GeoRegionValuePlot[populationLog, GeoRange->Entity["AdministrativeDivision",{"Hawaii","UnitedStates"}], ImageSize->240, PlotLegends->None];

Grid[{
    { contentinal, SpanFromLeft },
    { hi, ak }
}, Frame->All]

enter image description here

To be sure, worse fates have befallen humanity, but this really irritates me. Of course, I could force AK and HI to the same size, but that would distort one or the other.

What I want is a way to center a map on an Entity, as I'm doing, but then dictate the aspect ratio so that, in this case, the viewport for Alaska goes a few ticks farther north and south so that it matches Hawaii's aspect ratio. Does that make sense? I think I know how to do it the hard way, but I'm hoping there's an elegant solution that combines GeoRange and AspectRatio without skewing the image.

$\endgroup$
2
$\begingroup$

I don't know if this satisfies your desire for elegance but you can get there by specifying the right value for GeoRangePadding.

For example on my system I get plot heights of 152 and 157, so a Scaled value of 0.03 normalizes them.

To create a more extreme example I shall use California.

pop = Entity["AdministrativeDivision", {#, "UnitedStates"}] -> #2 & @@@ {{"Alaska", 
     740}, {"California", 39540}};

{ak, ca} = GeoRegionValuePlot[pop, 
     GeoRange -> Entity["AdministrativeDivision", {#, "UnitedStates"}], 
     GeoRangePadding -> {Scaled[#2], None}, ImageSize -> 240, 
     PlotLegends -> None] & @@@ {{"Alaska", 0.91}, {"California", 0}};

Grid[{{ca, ak}, {ak, ca}}, Frame -> All]

enter image description here

$\endgroup$
  • $\begingroup$ Works for me! Thanks much $\endgroup$ – Chris Wilson Jul 24 '18 at 13:39
  • $\begingroup$ @Chris Glad I could help! :-) $\endgroup$ – Mr.Wizard Jul 24 '18 at 13: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.