[R-sig-Geo] Map2points() substitute for class "map"

Fernando Mayer fernandomayer at gmail.com
Mon Feb 12 19:41:14 CET 2007


Roger, thanks for your explanations. Thanks also to Edzer Pebesma who 
provided soma additional improvements. However, now I think I have 2 
problems, as follows:

Roger Bivand escreveu:

> If you comment out the lines:
> 
> #  if(missing(map)) stop("map object is missing.")
> #  if(!inherits(map, "Map")) stop("Map.obj must be of class Map")
> #  if(missing(variable)) stop("variable to be plot is missing")
> 
> in ProportionalSymbolMap(), and rename the map argument as verts, you can 
> pass the coordinates in:
> 
> library(maps)
> map <- map("county", "illinois", fill=TRUE, col="transparent", plot=FALSE)
> library(maptools)
> str(map)
> ID <- substring(map$names, 10)
> ill <- map2SpatialPolygons(map, ID, proj4string=CRS("+proj=longlat"))
> plot(ill, axes=TRUE)
> x <- runif(102)
> ProportionalSymbolMap_rev(coordinates(ill), x, max.size=0.3)

# Problem 1

Doing exactly this, I have an error in

 > plot(ill, axes=TRUE)
Error in as.vector(x, "double") : cannot coerce to vector

and I was not able to find out what is going wrong. However if I do

 > map("county", "illinois", fill=TRUE, col="transparent", plot=T)

before all that code code and ignore the error, I can see the map with 
the proportional symbols. So I don't know exactly how long this error 
influence on what was to be the point here. But, I understood 
something new here and know comes the

# Problem 2

As far as I could understand, the polygon IDs are used to identify 
where the symbols are to be plotted (after the processment with 
map2SpatialPolygons()). Maybe it was my mistake haven't said this 
before, but what I'm trying to do is to plot the symbols not in the 
land, but in the ocean. So I think there's no polygon IDs in this case 
isn't?

What I'm trying to do exactly is maps to plot fishery data, with the 
symbols proportional to catch, effort, etc. I was trying something 
like this [1], which is a function using map(), degAxis(), quantile(), 
points(), legend(), etc. However I would like to improve this, mainly 
the legend and the way the symbols are plotted. That's why I was 
trying the ProportionalSymbolMap(). But now, because of the polygon 
IDs I'm not sure anymore how this could be done.

[1] http://img468.imageshack.us/img468/9397/rplot005us9.png

Thanks again for the explanations,
-- 
Fernando Mayer
Grupo de Estudos Pesqueiros - GEP
Centro de Ciências Tecnológicas, da Terra e do Mar - CTTMar
Universidade do Vale do Itajaí - UNIVALI
Itajaí - SC - Brasil
e-mail: fernandomayer [@] gmail.com




More information about the R-sig-Geo mailing list