[R] plot single part of the country using gadm map

Paul Murrell p.murrell at auckland.ac.nz
Mon Sep 27 22:01:17 CEST 2010


Hi

carolina plescia wrote:
> Dear all,
> 
> in GADM map there are three levels (nation, province and precinct) for each
> country of the world but for all of them you are never able to plot only one
> part of a chosen country.

The "Spatial" object you get when you read in the shapefile has 
convenient subsetting methods defined.  For example ...

library(maptools)

italy <- readShapeSpatial("ITA_adm1")
plot(italy)

liguria <- italy[italy$NAME_1 == "Liguria", ]
plot(liguria)

Is that what you are after?

Paul

> To be sure, I am trying to plot only one region of “Italy” and colour the
> different precincts in it. So far I am able to colour only the part of my
> interest but the programme still plot the whole country.
> 
> Is that a way to have only a chosen part of the country (ie. region or
> state) with all the specific subunits in it?
> 
> I have tried also to plot and then zoom but the “zoom” function seems to
> work only with “plot” while gadm map uses ”spplot”.
> 
> Anyone knows if the zoom command works also with spplot?
> 
> Any suggestions?
> 
> Thank you very much.
> Carolina
> 

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-help mailing list