symbolsInPolys           package:maptools           R Documentation

_P_l_a_c_e _g_r_i_d_s _o_f _p_o_i_n_t_s _o_v_e_r _p_o_l_y_g_o_n_s

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

     Place grids of points over polygons with chosen density and/or
     symbols (suggested by Michael Wolf) - the function uses functions
     from the splancs package internally.

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

     symbolsInPolys(pl, dens, symb = "+")

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

      pl: list of polygons of class 'polylist'

    dens: number of symbol plotting points per unit area; either a
          single numerical value for all polygons, or a numeric vector
          the same length as pl with values for each polygon

    symb: plotting symbol; either a single value for all polygons, or a
          vector the same length as pl with values for each polygon

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

     The dots are placed in a grid pattern with the number of points
     per polygon being polygon area times density (number of dots not
     guaranteed to be the same as the count). When the polygon is made
     up of more than one part, the dots will be placed in proportion to
     the relative areas of the clockwise rings (anticlockwise are taken
     as holes). No correction is made for holes in the placing of the
     dots.

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

     The function returns a list of matrices of point coordinates, one
     matrix for each member of pl; each matrix has a 'symb' attribute
     that can be used for setting the 'pch' argument for plotting. If
     the count of points for the given density and polygon area is
     zero, the list element is NULL, and can be tested when plotting -
     see the examples.

_N_o_t_e:

     Extension to plot pixmaps at the plotting points using addlogo()
     from the pixmap package is left as an exercise for the user.

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

     Roger Bivand Roger.Bivand@nhh.no

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

     'areapl', 'gridpts'

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

     x <- read.shape(system.file("shapes/sids.shp", package="maptools")[1])
     ncpolys <- Map2poly(x)
     np <- sapply(ncpolys, function(x) attr(x, "nPart"))
     symbs <- c("-", "+", "*")
     try1 <- symbolsInPolys(ncpolys, 70, symb=symbs[np])
     plot(ncpolys)
     xx <- lapply(try1, function(x) {if (!is.null(x)) points(x, pch=attr(x, "symb"))})

