MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Graphics and CityData

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84824] Re: [mg84807] Graphics and CityData
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Wed, 16 Jan 2008 03:21:39 -0500 (EST)
  • References: <200801150816.DAA11752@smc.vnet.net>

On Jan 15, 2008, at 3:16 AM, Charles L. Snyder wrote:

> Hi -
>
> Very limited Mathematica experience...
> I have a large table of cities and number of scientific publications:
>
> City          NumPubs
> Atlanta      220
> Chicago     130
> NewYork    100
> Wilmington 25
> Miami        10
> Denver       5
>
>
> I want to show the results cartographically, but I want to demonstrate
> larger numbers of publications by color (or preferably size) of the
> points. The following works, but only allows color to distinguish
> broad bins/categories (eg, top 25 are green, next 25 are blue, etc).
> Also, this results in repeated overlays instead of one graphic:
>
> g1 = Graphics[{LightBlue, CountryData["UnitedStates", "Polygon"],
>    PointSize[Medium], Green,
>    Point[Reverse[CityData[#, "Coordinates"]]] & /@  {"Alanta",
>      "Chicago"}}]
> g2 = Graphics[{Opacity[0.5], LightBlue,
>    CountryData["UnitedStates", "Polygon"], PointSize[Medium], Blue,
>    Point[Reverse[CityData[#, "Coordinates"]]] & /@  {"NewYork",
>      "Wilmington"}}]
> g3 = Graphics[{Opacity[0.5], LightBlue,
>    CountryData["UnitedStates", "Polygon"], PointSize[Medium], Black,
>    Point[Reverse[CityData[#, "Coordinates"]]] & /@  {"Miami",
>      "Denver"}}]
> Show[g1, g2, g3]
>
> Surely there is a better and easier way to do this
> -without a zillion overlays
> -perhaps with larger circle indicating more publications?
>
>
> Thanks in advance!

Here's a start, I scaled the point size linearly from 1/20th to  
1/40th of the total graphic size and cycled the colors from Red to  
Cyan (but there seems to be some interaction causing the colors to go  
from Cyan to Red through Green).

data={{"Atlanta",220},{"Chicago",130},{"New York",100},{"Wilmington", 
25},{"Miami",10},{"Denver",5}};
With[{maxpubs=Max[data[[All,2]]],minpubs=Min[data[[All, 
2]]],cities=data[[All,1]],numcities=Length 
[data],maxpoint=1/20,minpoint=1/40},Graphics[{Opacity 
[0.4],LightBlue,CountryData["UnitedStates","Polygon"],Opacity 
[1],Sequence@@Flatten[{PointSize[((maxpoint-minpoint) #[[2]]+maxpubs  
minpoint-maxpoint minpubs)/(maxpubs-minpubs)],Point[Reverse[CityData[# 
[[1]],"Coordinates"]]],Hue[0.5 (Position[cities,#[[1]]][[1]]-1)/ 
(numcities-1)]}&/@data]}]]

Hope this helps,

Ssezi


  • Prev by Date: Don't understand behavior of ClearAttributes[Plus,Orderless]
  • Next by Date: Re: Integral problem
  • Previous by thread: Graphics and CityData
  • Next by thread: Fill between points in ListPointPlot3D not working?