polyCutout              package:RSurvey              R Documentation

_C_u_t_o_u_t _G_r_i_d _P_o_i_n_t_s _w_i_t_h_i_n _P_o_l_y_g_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     This function excludes data points outside a given polygon.

_U_s_a_g_e:

     polyCutout(dat, ply)

_A_r_g_u_m_e_n_t_s:

     dat: a list containing 'x', 'y', and 'z' components, see Value
          section.

     ply: a polygon of class 'gpc.poly-class'.

_D_e_t_a_i_l_s:

     Returns 'NA' values for 'z' when points ('x', 'y') are located
     outside the polygon.

_V_a_l_u_e:

     A list containing the following components: 

       x: grid point locations in the x-direction.

       y: grid point locations in the y-direction.

       z: a matrix of state variable values corresponding to the grid.

_A_u_t_h_o_r(_s):

     Fisher, J. C.

_S_e_e _A_l_s_o:

     'point.in.polygon', 'filled.contour'

_E_x_a_m_p_l_e_s:

     x11()

     ply <- as(cbind(c(2, 8, 9, 6, 3), c(3, 1, 4, 8, 6)), "gpc.poly")
     x <- seq(0, 10, 0.1)
     y <- seq(0, 10, 0.1)
     z <- matrix(runif(length(x) * length(y)), 
          nrow = length(y), ncol = length(x))

     dat.old <- list(x = x, y = y, z = z)
     filled.contour(dat.old, 
         plot.axes = {axis(1); axis(2); plot(ply, add = TRUE)})

     dat.new <- polyCutout(dat.old, ply)
     filled.contour(dat.new, color.palette = terrain.colors)

