On Feb 14, 2013, at 8:05 AM, jas wrote:

calc_ext3.asc <http://r.789695.n4.nabble.com/file/n4658564/calc_ext3.asc >


I supplied a small extent of the grid, that I am trying to visualize. It s a ascii-grid with 800 cells. My goal is to display the Grid-Values as the z-variable. The point that I dont understand, is what is my input as x and
y-Variable in the persp-function? Do I have to make 8 vectors with 100
entries and plot them individually?

Your help is greatly appreciated,

jas

pop.grid
pop.mat <- as.matrix(pop.grid) # order is not right here already

z <- pop.mat
x <- 1:nrow(z)
y <- 1:nrow(z)
persp(x,y,z, phi=30,  border=NA)
# Error n persp.default(x, y, z, phi = 30, border = NA) :
 invalid 'z' Argument

I copied the space separated data from that webpage into my clipboard and executed this:

grd <- matrix( scan(), ncol=40, nrow=20)
# and pasted my clipboard
is.na(grd[] ) <- grd == -9999  # use a proper R missing value
 str(grd)
# num [1:20, 1:40] NA NA NA NA NA ...
 persp(z=grd)
 image(grd)

Alternatively you could have used read.table from that file with skip =6

The image looks rather disjointed and I'm hoping that lack of continuity is an artifact of extracting only a portion of the data.

--
David.






--
View this message in context: 
http://r.789695.n4.nabble.com/3D-plots-of-2D-grids-tp4658517p4658564.html
Sent from the R help mailing list archive at Nabble.com.

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

David Winsemius, MD
Alameda, CA, USA

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

Reply via email to