[R] persp()

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Thu Aug 4 14:21:39 CEST 2011


Hi Rosario,
you might have a look at the  "maps" and "maptools" (for reading
shape-files) packages.

#e.g.
library(maps)
map("world",c("sweden","germany"))

Cheers


Am 04.08.2011 02:58, schrieb Rosario Garcia Gil:
> Hello
> 
> I am trying to draw a basic black and white map of two European countries.
> 
> After searching some key words in google and reading many pages I arrived to the conclusion that persp() could be used to draw that map.
> 
> I have prepared three small example files, which are supposed to be the files required for running that function.
> 
> xvector is a vector with the longitudes
> yvector is a vector with the latitudes
> zmatrix is supposed to the height, but since I only need a flat map I just gave the value 1 to each of the entries of the matrix (I am not sure this is correct though).
> 
> The first question for me when using persp() is that x and y values should be in increasing values (following the instructions), but I understand that the coordinates x and y are actually pairs of values (longitude/latitude pairs of values) and if I order them in ascending order both then the pairing is gone. I guess I am totally lost!
> 
> Still even if I try to run persp() by ordering in ascending value x and y values (even if it does not make sense for me) I still get this message:
> 
> <-  persp(xvector,yvector,zmatrix,theta=-40,phi=30)
> Error in persp.default(xvector, yvector, zmatrix, theta = -40, phi = 30) : 
>   increasing 'x' and 'y' values expected
> 
> Any help is wellcome. Is there any other better function to draw a flat map (2D), also example of the imput files is wellcome. Thanks in advance.
> Rosario
> 
> 
> 
> 
> ______________________________________________
> 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.

-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790



More information about the R-help mailing list