[R] How to draw a map of Europe?

Spencer Graves spencer.graves at structuremonitoring.com
Sun Mar 20 03:47:22 CET 2011


       I've created historical maps using R, but it required careful 
research, translating the boundaries into longitude and latitude shape 
files, then plotting them, similar to the example that David just 
provided.  It seemed to be the easiest way I knew to produce the desired 
result, but it still took a moderate level of effort.


       Hope this helps.
       Spencer Graves


On 3/19/2011 6:51 PM, David Winsemius wrote:
>
> On Mar 19, 2011, at 8:32 PM, Sally Luo wrote:
>
>> Hi R users,
>>
>> I need to draw a map of select European countries with country names 
>> shown
>> on the map.  Does anyone know how to do this in R?
>
> Adding a tiny bit to the material produced from a search and finding 
> something from Roger Bivand in response to Rense Nieuwenhuis:
>
> http://finzi.psych.upenn.edu/R/Rhelp02/archive/85586.html
>
> require(maps)
>
>  country2001 <- c("Austria", "Belgium", "Switzerland",
>  "Czechoslovakia", "Germany", "Denmark", "Spain", "Finland", "France",
>  "UK", "Greece", "Hungary", "Ireland", "Israel", "Italy",
>  "Luxembourg", "Netherlands", "Norway", "Poland", "Portugal",
>  "Sweden", "Slovenia")
>  color2001 <- c("green", "yellow","red","red", "red", "red", "red",
>  "red", "green", "red", "red", "red", "red", "red", "red", "red",
>  "red", "blue", "red", "red", "red", "orange")
>
> europe$names[grep("Sicily", europe$names)] <- "Italy:Sicily"
> europe$names[grep("Sardinia", europe$names)] <- "Italy:Sardinia"
> match <- match.map(europe,country2001)
> color <- color2001[match]
> map(database="world", fill=TRUE, col=color, xlim=c(-25,70),ylim=c(35,71))
>
> text(0, 45, "France")
>
>
>>
>> Also, is it possible to draw a historical map of European countries 
>> using R?
>>
>> Thanks a lot for your help.
>>
>> Maomao
>>
>>     [[alternative HTML version deleted]]
>>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list