hdiffplot               package:hexbin               R Documentation

_P_l_o_t _o_f _D_o_m_a_i_n _a_n_d _M_e_d_i_a_n _D_i_f_f_e_r_e_n_c_e_s _o_f _T_w_o '_h_b_i_n' _O_b_j_e_c_t_s

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

     Let hbin1 and hbin2 represent two hexbin objects with scaling,
     plot shapes, and bin sizes. This plot distinguishes cells unique
     to hbin1, cells in common, and cells unique to hbin2 using color. 
     When the erode components are present, color also distinguishes
     the two erosion medians.  An arrow shows the vector from the
     median of hbin1 to the median of hbin2.

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

     hdiffplot(bin1, bin2, xbnds, ybnds, density,
               border = rep(FALSE, 6), pen = 2:7, size = 0.1, lwd = 2,
               eps = 1e-6, unzoom = 1.04,
               xlab = "", ylab = "", main = deparse(mycall), ...)

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

    bin1: an object of type hexbin.

    bin2: an object of type hexbin.

   xbnds: global x-axis plotting limits.  Used primarily for multiple
          comparison plots.

   ybnds: global y-axis plotting limits.  Used primarily for multiple
          comparison plots. 

 density: fill arguments to polygon

  border: border arguments to polygon

     pen: pen numbers for polgyon

    size: arrow type size in inches.

     eps: distance criteria for distinct medians

  unzoom: plot limit expansion factor when xbnds is missing

     lwd: To be added

    xlab: To be added

    ylab: To be added

    main: main title for the plot; automatically constructed by
          default.

     ...: To be added

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

     The hexbin objects for comparison, 'hbin1' and 'hbin2', must have
     the same plotting limits and cell size.  The plot produces a
     comparison overlay of the cells in the two objects.  If external
     global scaling is not supplied, the algorithm determines plotting
     limits to increase resolution.  For example, the objects may be
     the result of the 'erode.hexbin()' and include only high count
     cells containing 50 of the counts.  The density, border, and pen
     arguments correspond to the polygon function calls for plotting
     six types of cells.  The cell types are respectively:

       unique cells of hbin1,
       joint cells,
       unique cells of hbin2,
       median cell of hbin1,
       median cell of hbin2,
       median cell if identical.

     The 'erode' components of the hexbin objects must be present for
     the medians to plot.  The algorithm select a single cell for the
     median if there are algorithmic ties.

     The 'pen' numbers for types of cells start at Pen 2.  Pen 1 is
     presumed black.  The suggested six additional colors are light
     blue, light gray, light red, blue, red, and black.  The reference
     below shows an example for black and white printing.  That plot
     changes the six colors to light gray, dark gray, white, black,
     black, and black. It changes the 4th, 5th, and 6th argument of
     border to TRUE.  It also changes 4th, 5th and 6th argument of
     density to 0.  In other words cells in common do not show and
     medians cells appear as outlines.

     When 'xbnds' is missing, the plot changes graphics parameters and
     resets them.   The function also zooms in based on the available
     data to provide increased resolution.

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

     invisible("Done")

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

     see in 'hexagons'.

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

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

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

     #  Comparison of two bivariate boxplots
     x1 <- rnorm(10000)
     y1 <- rnorm(10000)
     x2 <- rnorm(10000,mean=.3)
     y2 <- rnorm(10000,mean=.3)
     xbnds <- range(x1,x2)
     ybnds <- range(y2,y2)

     bin1 <- hexbin(x1,y1,xbnds=xbnds,ybnds=ybnds)
     bin2 <- hexbin(x2,y2,xbnds=xbnds,ybnds=ybnds)
     erodebin1 <- erode.hexbin(smooth.hexbin(bin1))
     erodebin2 <- erode.hexbin(smooth.hexbin(bin2))

     hdiffplot(erodebin1,erodebin2)

