spplot                  package:sp                  R Documentation

_L_a_t_t_i_c_e (_t_r_e_l_l_i_s) _p_l_o_t_s _f_o_r _s_p_a_t_i_a_l _d_a_t_a

_D_e_s_c_r_i_p_t_i_o_n:

     plots for points, grids, polygons

_U_s_a_g_e:

     spplot(obj, ...)
     spplot.grid(obj, zcol = names(obj), ..., names.attr, 
             scales = list(draw = FALSE), xlab = "", ylab = "", aspect = mapasp(obj), 
             panel = panel.gridplot, sp.layout = NULL, formula)
     spplot.rings(obj, zcol = names(obj), ..., names.attr, 
             scales = list(draw = FALSE), xlab = "", ylab = "", aspect = mapasp(obj), 
             panel = panel.ringsplot, sp.layout = NULL, formula)
     spplot.points(obj, zcol = names(obj), ..., names.attr, 
             scales = list(draw = FALSE), xlab = "", ylab = "", aspect = mapasp(obj), 
             panel = panel.pointsplot, sp.layout = NULL, identify = FALSE, formula)
     mapLegendGrob(obj, widths = unit(1, "cm"), heights = unit(1, "cm"),
             fill = "black", just = "right")
     sp.theme()
     layout.north.arrow()
     layout.scale.bar(height = 0.05)

_A_r_g_u_m_e_n_t_s:

     obj: object of class extending Spatial-class

    zcol: character; attribute name(s) or column number(s) in attribute
          table 

names.attr: names to use in panel, if different from zcol names 

  scales: scales argument to be passed to Lattice plots; use 'list(draw
          = TRUE)' to draw axes scales; see xyplot for full options 

     ...: other arguments passed to levelplot (grids, polygons) or 
          xyplot (points) 

    xlab: label for x-axis 

    ylab: label for y-axis 

  aspect: aspect ratio for spatial axes; defaults to "iso" (one unit on
          the x-axis equals one unit on the y-axis) but may be set to
          more suitable values if the data are e.g. if coordinates are
          latitude/longitude 

   panel: depending on the class of obj, panel.ringsplot (for rings or
          lines), panel.gridplot (grids) or panel.pointsplot (points)
          is used; for further control custom panel functions can be
          supplied that call one of these panel functions, but do read
          how the argument 'sp.layout' may help 

sp.layout: NULL or list; see notes below

identify: if not FALSE, identify plotted objects (currently only
          working for points plots). Labels for identification are the
          row.names of the attribute table
          'row.names(as.data.frame(obj))'. If TRUE, identify on panel
          '(1,1)'; for identifying on panel 'i,j', pass the value
          'c(i,j)'

 formula: optional; may be useful to plot a transformed value. Defaults
          to 'z~x+y' for single and 'z~x+y|name' for multiple
          attributes; use e.g. 'exp(x)~x+y|name' to plot the exponent
          of the z-variable

  widths: width of grob

 heights: heights of grob

    fill: fill color of grob

    just: grob placement justification

  height: height of scale bar; width is 1.0

_V_a_l_u_e:

     spplot returns a lattice plot of class "trellis", if you fail to
     "see" it, explicitly call 'print(spplot(...))'. If 'identify' is
     TRUE, the plot is plotted and the return value is a vector with
     row names of the selected points.

_N_o_t_e:

     Missing values in the attributes are (currently) not allowed.

     'spplot.grid', 'spplot.rings' and 'spplot.points' are S4 methods
     for 'spplot'; see spplot-methods.

     Useful arguments that can be passed as '...' are: 

     '_l_a_y_o_u_t' for the layout of panels

     '_c_o_l._r_e_g_i_o_n_s' to specify fill colours

     '_p_r_e_t_t_y' for colour breaks at pretty numbers

     '_a_t' to specify at which values colours change

     '_a_s._t_a_b_l_e' to start drawing panels upper-left instead of
          lower-left

     '_p_a_g_e' to add marks to each plotted page

     for useful values see the appropriate documentation of xyplot and
     levelplot.

     If 'obj' is of SpatialPointsDataFrame, the following options are
     useful to pass:

     '_k_e_y._s_p_a_c_e' character: "bottom", "right", "left" or "right" to
          denote key location, or list: see argument key in the help
          for xyplot what the options are

     '_l_e_g_e_n_d_E_n_t_r_i_e_s' character; array with key legend (text) entries; 
          suitable defaults obtained from data 

     '_c_u_t_s' number of cuts or the actual cuts to use

     '_d_o._l_o_g' logical; if TRUE use log-linear scale to divide range in
          equal cuts, else use a linear scale if 'cuts' is only number
          of cuts 

     '_p_c_h' integer; plotting character to use; defaults to 16 if fill
          is TRUE, else 1 

     '_c_e_x' numeric; character expansion, proportional to default value
          of 1

     '_f_i_l_l' logical; use filled circles? 

     'layout.north.arrow' and 'layout.scale.bar' can be used to set a
     north arrow or scale bar.

     The 'sp.layout' argument is either a single layout item, or a list
     with a layout items. A layout item is a list with its first
     argument the name of the layout function to be called: 'sp.points'
     for SpatialPoints, 'sp.polygon' for SpatialPolygons object,
     'sp.lines' for a SpatialLines object, and 'sp.text' for text to
     place. The second argument contains the object (or text) to be
     plotted; remaining arguments are passed to the corresponding
     'panel.*' functions.

     A special layout list item is 'which' (integer), to control to
     which panel a layout item should be added. If 'which' is present
     in the main, top-level list it applies for all layout items; in
     sub-lists with layout items it denotes the (set of) panels in
     which the layout item should be drawn.  Without a 'which' item,
     layout items are drawn in each panel.

     The order of items in 'sp.layout' matters; objects are drawn in
     the order they appear. Plot order and prevalence of sp.layout
     items: for points and lines, sp.layout items are drawn before the
     points (to allow for grids and polygons); for grids and polygons
     sp.layout is drawn afterwards (so the item will not be overdrawn
     by the grid and/or polygon). Although a matter of taste,
     transparency may help when combining things.

     'sp.theme' returns a lattice theme; use
     'trellis.par.set(sp.theme())' after a device is opened or changed
     to make this work. Currently, this only sets the colors to
     bpy.colors.

_A_u_t_h_o_r(_s):

     Edzer J. Pebesma, e.pebesma@geo.uu.nl

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://r-spatial.sourceforge.net/>

_S_e_e _A_l_s_o:

_E_x_a_m_p_l_e_s:

     library(lattice)
     trellis.par.set(sp.theme()) # sets bpy.colors() ramp
     data(meuse)
     coordinates(meuse) <- ~x+y
     l2 = list("SpatialPolygonsRescale", layout.north.arrow(), offset = c(181300,329800), 
             scale = 400)
     l3 = list("SpatialPolygonsRescale", layout.scale.bar(), offset = c(180500,329800), 
             scale = 500, fill=c("transparent","black"))
     l4 = list("sp.text", c(180500,329900), "0")
     l5 = list("sp.text", c(181000,329900), "500 m")

     spplot(meuse, c("ffreq"), sp.layout=list(l2,l3,l4,l5),col.regions="black",pch=c(1,2,3),
             key.space=list(x=0.1,y=.95,corner=c(0,1)))
     spplot(meuse, c("zinc", "lead"), sp.layout=list(l2,l3,l4,l5, which = 2),
             key.space=list(x=0.1,y=.95,corner=c(0,1)))

     if (require(RColorBrewer)) {
             spplot(meuse, c("ffreq"), sp.layout=list(l2,l3,l4,l5),
                     col.regions=brewer.pal(3, "Set1"))
     }

