[R] persp()

Johannes Hüsing johannes at huesing.name
Fri Aug 5 12:06:56 CEST 2011


Am Donnerstag, den 04.08.2011, 02:58 +0200 schrieb Rosario Garcia Gil:
> I am trying to draw a basic black and white map of two European countries.
> 

Are you planning just to draw the boundaries? Or what do you mean by
"basic black and white".

> 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.


If you want to create a 3D map where z are, say, the altitudes, yes.

Have you read http://cran.r-project.org/view=spatial ? There is no
mentioning of persp().

> I have prepared three small example files, which are supposed to be the files required for running that function.
> 

I haven't seen these files as attachments of your mail. I am 
certain they would help us a lot to see what your problem is. 

> 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).
> 

Then persp() will draw you a mesh of a flat plane, which is not
informative, which gives me the impression that persp() is not hat you
need. Have you run example(persp) at all? The result does not even look
"basic black and white".

> 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.



More information about the R-help mailing list