2
$\begingroup$

Is there a way to make the bar legends show the values 1 to 9000 using a logarithmic scale than what Mathematica is automatically giving me? Here's my plot: enter image description here The data I am using:

geoVal = {Entity["AdministrativeDivision", {"Alaska", "UnitedStates"}] -> 
9033, Entity["Country", "Albania"] -> 1, 
Entity["Country", "Algeria"] -> 1, 
Entity["Country", "Argentina"] -> 48, 
Entity["Country", "Australia"] -> 588, 
Entity["Country", "Austria"] -> 39, 
Entity["Country", "Bahamas"] -> 2, 
Entity["Country", "Bangladesh"] -> 2, 
Entity["Country", "Belgium"] -> 25, 
Entity["Country", "Bolivia"] -> 3, 
Entity["Country", "BosniaHerzegovina"] -> 1, 
Entity["Country", "Brazil"] -> 114, 
Entity["Country", "Bulgaria"] -> 7, 
Entity["Country", "Canada"] -> 1119, 
Entity["Country", "Chile"] -> 25, 
Entity["Country", "China"] -> 12,
Entity["Country", "Colombia"] -> 11, 
Entity["Country", "CostaRica"] -> 5, 
Entity["Country", "Croatia"] -> 12, 
Entity["Country", "Cuba"] -> 1,
Entity["Country", "CzechRepublic"] -> 15, 
Entity["Country", "Denmark"] -> 103, 
Entity["Country", "Ecuador"] -> 2, 
Entity["Country", "Egypt"] -> 3,
Entity["Country", "ElSalvador"] -> 2, 
Entity["Country", "Estonia"] -> 11, 
Entity["Country", "FaroeIslands"] -> 2, 
Entity["Country", "Finland"] -> 126, 
Entity["Country", "France"] -> 89, 
Entity["Country", "Germany"] -> 293, 
Entity["Country", "Greece"] -> 10, 
Entity["Country", "Guatemala"] -> 2, 
Entity["Country", "Guyana"] -> 1, 
Entity["AdministrativeDivision", {"Hawaii", "UnitedStates"}] -> 
    9033, 
Entity["Country", "Honduras"] -> 1, 
Entity["Country", "Hungary"] -> 22, 
Entity["Country", "Iceland"] -> 6, 
Entity["Country", "India"] -> 28, 
Entity["Country", "Indonesia"] -> 8, 
Entity["Country", "Iran"] -> 1, Entity["Country", "Ireland"] -> 77,
Entity["Country", "Israel"] -> 26, 
Entity["Country", "Italy"] -> 61, 
Entity["Country", "Jamaica"] -> 1, 
Entity["Country", "Japan"] -> 27, 
Entity["Country", "Kazakhstan"] -> 1, 
Entity["Country", "Kenya"] -> 1, Entity["Country", "Latvia"] -> 6, 
Entity["Country", "Lebanon"] -> 2, Entity["Country", "Libya"] -> 1,
Entity["Country", "Lithuania"] -> 6, 
Entity["Country", "Macedonia"] -> 2, 
Entity["Country", "Malaysia"] -> 13, 
Entity["Country", "Malta"] -> 2, 
Entity["Country", "Mauritius"] -> 1, 
Entity["Country", "Mexico"] -> 74, 
Entity["Country", "Myanmar"] -> 2, 
Entity["Country", "Netherlands"] -> 105, 
Entity["Country", "NewZealand"] -> 129, 
Entity["Country", "Norway"] -> 68, Entity["Country", "Oman"] -> 1, 
Entity["Country", "Pakistan"] -> 1, 
Entity["Country", "Panama"] -> 3, 
Entity["Country", "Paraguay"] -> 1, 
Entity["Country", "Peru"] -> 11, 
Entity["Country", "Philippines"] -> 28, 
Entity["Country", "Poland"] -> 65, 
Entity["Country", "Portugal"] -> 29, 
Entity["Country", "PuertoRico"] -> 3, 
Entity["Country", "Romania"] -> 8, 
Entity["Country", "Russia"] -> 18, 
Entity["Country", "SaudiArabia"] -> 1, 
Entity["Country", "Serbia"] -> 7, 
Entity["Country", "Singapore"] -> 27, 
Entity["Country", "Slovakia"] -> 6, 
Entity["Country", "Slovenia"] -> 6, 
Entity["Country", "SouthAfrica"] -> 21, 
Entity["Country", "SouthKorea"] -> 6, 
Entity["Country", "Spain"] -> 60, Entity["Country", "Sudan"] -> 2, 
Entity["Country", "Sweden"] -> 115, 
Entity["Country", "Switzerland"] -> 18, 
Entity["Country", "Syria"] -> 1, 
Entity["Country", "Thailand"] -> 3, 
Entity["Country", "TrinidadTobago"] -> 6, 
Entity["Country", "Turkey"] -> 6, 
Entity["Country", "Ukraine"] -> 9, Entity["Country", "UAE"] -> 3, 
Entity["Country", "UK"] -> 1285, Entity["Country", "USA"] -> 9033, 
Entity["Country", "Uruguay"] -> 4, 
Entity["Country", "Venezuela"] -> 8, 
Entity["Country", "Vietnam"] -> 7, 
Entity["Country", "Zimbabwe"] -> 1};

and my plot is generated with:

GeoRegionValuePlot[geoVal, ColorFunctionScaling -> False, 
 ColorFunction -> (ColorData[{"BrightBands", {9, 0}}][
     Log@QuantityMagnitude@#] &), 
 GeoBackground -> {"Coastlines", "Land" -> White, "Border" -> Gray}, 
 GeoProjection -> "Robinson"]

I tried using PlotLengends->BarLegends and using the color function I specified and setting the min as 1 and the max as 10000, but it made a legend that was pretty much entirely red. I was trying to base my code off of this post I found: https://community.wolfram.com/groups/-/m/t/854271 but even just copy and pasting his code I wasn't able to generate the graph that he posted, and the plot legends was way off there. I had to play around with the color function until I found one that I thought suitable demonstrated the range in frequency values.

Unrelated to the PlotLegends question, but if anyone knows a more efficient way to include Alaska and Hawaii in the graph besides manually adding them with the frequency value for the US, that'd be much appreciated.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.