> Date: Fri, 19 Nov 2004 15:59:25 -0500
> From: Michael Friendly <[EMAIL PROTECTED]>
> 
> Here's what I tried.   I can plot a selection of regions, but I
> can't seem to remove an arbitrary list of region numbers, unless I've 
> done something wrong
> by selecting the regions I want to plot with departements[-exclude].

I think here the problemis not using exact=T in the call to map(), see
below.

> I also get an error
> when I try to use map.text to label a map with only the regions I'm  
> selecting.
> 
>  > departements <- map('france',namesonly=T, plot=FALSE)
>  > # returns a vector of names of regions
>  >
>  > exclude <- c(47,  #Alpes-Maritimes
> + 66,  # Haute-Savoie
> + 76,  # Savoie
> + 95,  # Territore-de-Belfort
> + 109, 110, 111, # Var: Iles d'Hyeres
> + 49, 53, 54, 55, # Moribhan: Isles
> + 62, 64,    # Vendee: Isles
> + 72, 75     # Charente-Maritime: Isles
> + )
>  >
>  > depts <- departements[-exclude]
>  > gfrance <-map('france', regions=depts)
>  > labels <- (as.character(1:length(departements)))[-exclude]
>  > gfrance <-map.text('france', regions=depts, add=FALSE, labels=labels)
> Error in map.text("france", regions = depts, add = FALSE, labels = labels) :
>         map object must have polygons (fill=TRUE)
> 
That error message is issued when regions= specifies less than the whole
database, in which case the alternate "list of 'x', 'y', and 'names'
obtained from a previous call to 'map'" is required as a first parameter.

So to do what you want (notwithstanding the next problem you raise), try
the following as a demonstration:

gfrance <- map('france', regions=depts, exact=T, fill=T, plot=F)
map.text(gfrance, regions=depts, labels=labels)  
map('france', regions=departements[exclude], fill=T, col=1, add=T)

> Another problem, potentially more difficult for mapping data on the map 
> of France is that
> the "departements" are actually just the polygons in the map, 
> arbitrarily numbered from
> east to west, and from north to south --- they don't correspond to the 
> 'official' administrative
> region numbers.  As well, the departement names don't always match 
> exactly (ignoring
> accents, e.g., Val-d'Oise vs. Val-Doise) so it would be another 
> challenge to plot my
> historical data on the map of France.
> 
Well, maps is a source package! [:-)].

You are most welcome to modify the source files
maps/src/france.{gon,line,name} to reorder the polygons (and correct
errors in the names).  If the relationship between those 3 files is not
obvious, contact me for further details.  Also, I am happy to fold your
changes back into the original maps package.

Ray Brownrigg

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to