Rosario, I don't think persp() is the function you need.
You may find that the maps in R's historical world map would work for you. In that case you can try something like this (an example mapping France and Germany): require(maps) map("world", c("France", "Germany"), xlim=c(-6.61, 17.21), ylim=c(40.73, 57.92)) If that doesn't meet your needs, you can use your own longitudes and latitudes to draw the country borders, for example: require(maps) long <- c(-1.15, 1.45, 2.49, -0.37, -0.11, -2.56, -2.87, -5.52, -3.81, -3.81, -1.15) lat <- c(50.50, 52.35, 54.12, 54.91, 53.17, 52.21, 54.06, 53.61, 50.71, 50.71, 50.50) # use the map() function to set up the long/lat projection without drawing anything map("world", xlim=range(long), ylim=range(lat), type="n") lines(long, lat) Jean `·.,, ><(((º> `·.,, ><(((º> `·.,, ><(((º> Jean V. Adams Statistician U.S. Geological Survey Great Lakes Science Center 223 East Steinfest Road Antigo, WI 54409 USA From: Rosario Garcia Gil <m.rosario.gar...@slu.se> To: "r-help@r-project.org" <r-help@r-project.org> Date: 08/04/2011 01:05 AM Subject: [R] persp() Sent by: r-help-boun...@r-project.org 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@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. [[alternative HTML version deleted]]
______________________________________________ R-help@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.