How to specify Log10 bin height scale in GeoHistogram function?
This is a bit of a hack but you may be able to get what you want down this path. Instead of taking the Log10
of the data I'll try to change the color scale via the ColorFunction
The base for the color function
Clear[cf]
cf[x_, min_, max_] := (Log10[x] - Log10[min])/(
Log10[max] - Log10[min]);
I use the function with the ColorFunction
option
min = 1;
max = 2000;
steps = Round[10^# & /@ Subdivide[Log10[min], Log10[2 max], 10]];
obj = GeoHistogram[geoData, Quantity[600, ("Miles")^2],
GeoBackground -> None,
GeoRangePadding -> 150 Quantity[1, "Kilometers"],
ColorFunctionScaling -> False,
ColorFunction ->
Function[{z}, ColorData["TemperatureMap"][cf[z, min, max]]],
PlotLegends -> BarLegend[{
Function[{z}, ColorData["TemperatureMap"][cf[z, min, max]]], {min,
max}},
steps]]
You will want to play with the min
and max
values and possibly hand edit your steps for the scale.
Modification of c186282's answer that shows Log10 scaling, with custom step intervals given, intermediate tics, and use of Blend
to specify custom color function.
geoState = WolframAlpha["state of New York", "Result"];
cf3 = Function[{z},
Blend[{Lighter[Blue, 0.9], Lighter[Blue, 0.6], Red, Yellow},
cf[z, min, max]]];
decades = 4;
min = 1;
max = 10^decades;
steps = Sort[Flatten[{#* 10^Range[min - 1, decades] & /@ {1, 5}}]];
plt = GeoHistogram[geoData, Quantity[600, ("Miles")^2], "Count",
GeoBackground -> None,
GeoRangePadding -> 150 Quantity[1, "Kilometers"],
ColorFunctionScaling -> False, ColorFunction -> cf3,
PlotLegends -> BarLegend[{cf3, {min, max}}, steps]];
Show[GeoGraphics[{GeoStyling["OutlineMap"], GeoStyling[White],
EdgeForm[{Black, Gray}], Polygon[geoState]},
GeoScaleBar -> "Miles"], plt]
Which gives the following plot:
I have verified that this is working with "Counts". If you change to another geo-bin value (e.g. "Intensity"), the color scale {min,max} needs to be re-calibrated.
So, the bounty goes to c186282. Many thanks!