image-methods             package:Matrix             R Documentation

_M_e_t_h_o_d_s _f_o_r _i_m_a_g_e() _i_n _P_a_c_k_a_g_e '_M_a_t_r_i_x'

_D_e_s_c_r_i_p_t_i_o_n:

     Methods for function 'image' in package 'Matrix'.  An image of a
     matrix simply color codes all matrix entries and draws the n x m
     matrix using an n x m grid of (colored) rectangles.

_U_s_a_g_e:

     ## S4 method for signature 'dgTMatrix':
     image(x,
           xlim = .5 + c(0, di[2]),
           ylim = .5 + c(di[1], 0), aspect = "iso",
           sub = sprintf("Dimensions: %d x %d", di[1], di[2]),
           xlab = "Column", ylab = "Row",
           useAbs = NULL, colorkey = !useAbs,
           col.regions = NULL,
           lwd = NULL, ...)

_A_r_g_u_m_e_n_t_s:

       x: a Matrix object, i.e., fulfilling 'is(x, "Matrix")'.

xlim, ylim: x- and y-axis limits; may be used to "zoom into" matrix.

  aspect: aspect ratio specified as number (y/x) or string; see
          'levelplot'.

sub, xlab, ylab: axis annotation with sensible defaults; see
          'plot.default'.

  useAbs: logical indicating if 'abs(x)' should be shown; if 'TRUE',
          the former (implicit) default, the default 'col.regions' will
          be 'grey' colors (and no 'colorkey' drawn).  The default is
          'FALSE' unless the matrix has no negative entries.

colorkey: logical indicating if a color key aka 'legend' should be
          produced.  Default is to draw one, unless 'useAbs' is true.

col.regions: vector of gradually varying colors; see 'levelplot'.

     lwd: non-negative number or 'NULL' (default), specifying the
          line-width of the rectangles of each non-zero matrix entry
          (drawn by 'grid.rect').  The default depends on the matrix
          dimension and the device size.

     ...: further arguments passed to methods and 'levelplot'.

_M_e_t_h_o_d_s:

     All methods currently end up calling the method for the
     'dgTMatrix' class. Use 'showMethods(image)' to list them all.

_E_x_a_m_p_l_e_s:

     showMethods(image)
     ## If you want to see all the methods' implementations:
     showMethods(image, incl=TRUE, inherit=FALSE)

     data(CAex)
     image(CAex, main = "image(CAex)")
     image(CAex, useAbs=TRUE, main = "image(CAex, useAbs=TRUE)")

     cCA <- Cholesky(crossprod(CAex), Imult = .01)
     image(cCA, main="Cholesky(crossprod(CAex), Imult = .01)")
     image(cCA, useAbs=TRUE)

     data(USCounties)
     image(USCounties)# huge
     image(sign(USCounties))## just the pattern
         # how the result looks, may depend heavily on
         # the device, screen resolution, antialiasing etc
         # e.g. x11(type="Xlib") may show very differently than cairo-based

     ## Drawing borders around each rectangle;
         # again, viewing depends very much on the device:
     image(USCounties[1:400,1:200], lwd=.1)
     image(USCounties[1:200,1:200], lwd=.5)
     image(USCounties[1:200,1:200], lwd=.01)

