Re: Worldplot package

• To: mathgroup at smc.vnet.net
• Subject: [mg128907] Re: Worldplot package
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Mon, 3 Dec 2012 04:06:28 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net

```Color by population

data = SortBy[{#, CountryData[#, "Population"]} & /@
CountryData[],
Last] // Reverse;

colors2 = Blend[{Red, Blue}, #] & /@
Rescale[data[[All, 2]]];

data2 = Transpose[Append[Transpose[data], colors2]];

Graphics[{#[[3]], EdgeForm[{Gray, Thin}],
Tooltip[CountryData[#[[1]], "SchematicPolygon"],
#[[1 ;; 2]]]} & /@ data2,
PlotLabel -> Style["By Population", Bold, 14],
ImageSize -> 432]

The wide range in the population data provides little variation. This
can be offset by using population rankings rather than population.

Color by population rank:

rank3 = Range[Length[data]];

data3 = Transpose[Append[Transpose[data], rank3]];

colors3 = Blend[{Red, Blue}, #] & /@
(1. - Rescale[rank3]);

data3 = Transpose[Append[Transpose[data3], colors3]];

Graphics[{#[[4]], EdgeForm[{Gray, Thin}],
Tooltip[CountryData[#[[1]], "SchematicPolygon"],
#[[{1, 3, 2}]]]} & /@ data3,
PlotLabel -> Style["By Population Rank", Bold, 14],
ImageSize -> 432]

Color by population density

data4 = SortBy[{#, CountryData[#, "Population"]/
CountryData[#, "Area"]} & /@
CountryData[], Last] // Reverse;

colors5 = Blend[{Red, Blue}, #] & /@
Rescale[data4[[All, 2]]];

data5 = Transpose[Append[Transpose[data4], colors5]];

Graphics[{#[[3]], EdgeForm[{Gray, Thin}],
Tooltip[CountryData[#[[1]], "SchematicPolygon"],
#[[1 ;; 2]]]} & /@ data5,
PlotLabel -> Style["By Population Density", Bold, 14],
ImageSize -> 432]

The wide range in the population densities coupled with the fact that
the highest densities are in some of the smaller states provides
little contrast.

Most /@ Take[data5, 10]

Again, using rankings helps to provide additional contrast.

Color by population density rank

data6 = Transpose[Append[Transpose[data4], rank3]];

data7 = Transpose[Append[Transpose[data6], colors3]];

Graphics[{#[[4]], EdgeForm[{Gray, Thin}],
Tooltip[CountryData[#[[1]], "SchematicPolygon"],
#[[{1, 3, 2}]]]} & /@ data7,
PlotLabel ->
Style["By Population Density Rank", Bold, 14],
ImageSize -> 432]

Or instead of Blend you could use a color scheme in any of the above

colors8 = ColorData["TemperatureMap"][#] & /@
Rescale[rank3];

data8 = Transpose[Append[Transpose[data6], colors8]];

Graphics[{#[[4]], EdgeForm[{Gray, Thin}],
Tooltip[CountryData[#[[1]], "SchematicPolygon"],
#[[{1, 3, 2}]]]} & /@ data8,
PlotLabel ->
Style["By Population Density Rank", Bold, 14],
ImageSize -> 432]

Bob Hanlon

On Sat, Dec 1, 2012 at 4:36 AM, Andrea Costamagna
<andreacosta88 at alice.it> wrote:
> Hi, I have some problem with the use of worldplot.I need to load a txt
> file, the first column has the names of states, and the second column
> there are values. I have to color the global map, so that the colors are
> proportional to the values. For example, the highest value will be blue
> and the lower red, with all the gradations for the intermediate
> values=E2=80=8B=E2=80=8B.Thanks to all.
>
> Best regards
>
> Andrea Costamagna
>
>
>

```

• Prev by Date: Re: Creating a Function to Display Numbers in Percent Format
• Next by Date: v9: variable name colour?
• Previous by thread: Worldplot package
• Next by thread: Re: domain restriction in NSolve does not work