hexbin                package:hexbin                R Documentation

_b_i_v_a_r_i_a_t_e _b_i_n_n_i_n_g _i_n_t_o _h_e_x_a_g_o_n _c_e_l_l_s

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

     Creates an list object. Basic components are a cell id and a count
     of points falling in each occupied cell.

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

     hexbin(x, y, xbins=30, shape=1, xbnds=range(x), ybnds=range(y))

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

       x: a vector of numbers.  The first coordinate of bivariate data
          to be binned.

       y: a vector of numbers.  The second coordinate of bivariate data
          to be binned.

   xbins: The number of bins partitioning the range of xbnds.

   shape: The shape=yheight/xwidth of the plotting regions.

   xbnds: The horizontal limits of the binning region in x units.

   ybnds: The  vertical limits of the binning region in y units.

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

     Returns counts for non-empty cells.  The plot shape must be
     maintained for hexagons to appear with equal sides.  Calculations
     are in single precision.

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

     an object of type hexbin The list structure typically contains the
     following components: 

    cell: A vector of cell ids that can be mapped into the (x,y) bin
          centers in data units.

     cnt: A  vector of counts in the cells.

     xcm: The x center of mass (average of x values) for the cell.

     ycm: The y center of mass (average of y values) for the cell.

   xbins: number of hexagons across the x axis. hexagon inner diameter
          =diff(xbnds)/xbins in x units

   xbnds: x coordinate bounds for binning and plotting

   ybnds: y coordinate bounds for binning and plotting

   shape: plot shape= yheight(inches)/xwidth(inches)

     dim: The i and j limits of cnt treated as a matrix cnt[i,j]

_R_e_f_e_r_e_n_c_e_s:

     Carr, D. B. et al. (1987) "Scatterplot Matrix Techniques for Large
     N", _JASA_ *83*, 398, 424-436.

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

     smooth.hexbin, erode.hexbin, hthin, hcell2xy, hcell, plot.hexbin,
     hboxplot, hdiffplot, hmatplot, hexagons, hex.legend

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

     x <- rnorm(10000)
     y <- rnorm(10000)
     bin <- hexbin(x,y)

     ## Using plot method for hexbin objects:
     plot(bin, style = "nested.lattice")
     # lower resolution binning and overplotting with counts
     bin <- hexbin(x,y,xbins=25)
     screenpar <- plot.hexbin(bin, style="lattice", minarea=1, maxarea=1,
                        density=0, border=TRUE)
     oldpar <- par(screenpar)     # reset graphics to the plot on the screen
     xy <- hcell2xy(bin)
     text(xy$x,xy$y,as.character(bin$cnt),adj=.5,cex=.3)
     points(x,y)       # to show points rather than counts
     par(oldpar)       #reset graphics

