[R-sig-Geo] spatstat inverse-distance-weighted plot - change the axis range
Kristin Graves
kristin.graves at gmail.com
Sat Aug 16 21:08:50 CEST 2014
Hello --
I am pretty new to R and to spatstat, so apologize for any ignorance.
I have a dataset with three variables: x, y, and avgidw where x and y are
UTM coordinates and avgidw is a numeric mask of type "double". My x range
is (585000,610000) and my y range is (4473000,4523000).
My end goal is to create an IDW plot that limits the plot to the (x,y)
range. I am able to obtain the plot, but the y-axis origin is zero, not
4473000 as desired. My code is below.
> library(spatstat)
spatstat 1.38-0 (nickname: ‘Wicked Plot’)
For an introduction to spatstat, type ‘beginner’
Warning message:
package ‘spatstat’ was built under R version 3.1.1
> idw_df <- read.table(idw_input, header=TRUE)
> attach(idw_df)
> idw_pp <- ppp(x, y, c(585000,610000), c(4473000,4523000), marks=avgidw)
> idw_win <- owin(c(585000,610000), c(4473000,4523000))
> idw_chop <- idw_pp[idw_win]
> x=585000:610000
> y=4473000:4523000
> idw_mask <- as.mask(idw_win,xy=list(x=x, y=y))
> idw_pix2 <- idw(idw_chop, power=2, at="pixels", idw_mask)
Error in ensure2vector(eps) : eps is not numeric
>
On the other hand, if I run this code I do obtain a plot (albeit with the
wrong axes):
> idw_pix2 <- idw(idw_chop, power=2, at="pixels")
> plot(idw_pix2)
Thanks in advance for any help you can provide!
Kristin Graves
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list