[R-sig-Geo] Adding some data as colors to world map

Gregor Gorjanc gregor.gorjanc at gmail.com
Sat Mar 11 01:11:20 CET 2006


Hello!

I appologize for my absence but I was completely stuffed with my work in
last days. I would like to express thanks to all who took their time and
showed various ways how to accomplish my task. I did not expect to get
so many valuable responses. I will plot data from FAOSTAT database
http://faostat.fao.org/faostat/collections?subset=agriculture

...
> 
> 
> I've produced a world map with ISO3166 two-letter codes. To get your
> codes right - this lists out country names and codes:
> 
> as(world_countries, "data.frame")
> 

OK, I will need to do the mapping, since FAO uses full names for
countries, but that is a minor problem. I will just create a list of
mappings and apply it.

> then
> 
> countries <- c("AU", "US", "AR") colours <- c("blue", "red", "green")
>  plot(world_countries, col=colours[match(world_countries$ISO3166,
> countries)])
> 

Very clean and nice solution. I like it. If I would also go for bubbles,
how can I determine the position where to put the bubble on i.e. "the
center" of the country?

> gives the attached PNG. Shall I make an .RData file of the 
> SpatialPolygonsDataFrame object available?

Yes, please do.

Many thanks again!!!

P.S. In one of previous posts you mentioned
> The advantage of the sp class representation here is that we can
> project the data to make areas more comparable if you need that,
> otherwise Greenland, Russia, and Canada dominate totally!
Can you please elaborate a bit further on this topic since I do not
follow it fully. Perhaps you can show on above example.

P.P.S. Did you "get any further" with Giovanni's tutorial and recent
changes in maptools?

-- 
Lep pozdrav / With regards,
    Gregor Gorjanc

----------------------------------------------------------------------
University of Ljubljana     PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si

SI-1230 Domzale             tel: +386 (0)1 72 17 861
Slovenia, Europe            fax: +386 (0)1 72 17 888

----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.




More information about the R-sig-Geo mailing list