Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12586 > unrolled thread
| Started by | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| First post | 2012-12-03 09:04 +0000 |
| Last post | 2012-12-03 09:04 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Worldplot package Bob Hanlon <hanlonr357@gmail.com> - 2012-12-03 09:04 +0000
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Date | 2012-12-03 09:04 +0000 |
| Subject | Re: Worldplot package |
| Message-ID | <k9hpvm$1jo$1@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@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 top | Article view | comp.soft-sys.math.mathematica
csiph-web