Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12586

Re: Worldplot package

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Worldplot package
Date 2012-12-03 09:04 +0000
Message-ID <k9hpvm$1jo$1@smc.vnet.net> (permalink)
References <20121201093610.797AD6897@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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@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
>
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Worldplot package Bob Hanlon <hanlonr357@gmail.com> - 2012-12-03 09:04 +0000

csiph-web