tabplot                 package:Epi                 R Documentation

_G_r_a_p_h_i_c_a_l _d_i_s_p_l_a_y _o_f _a _2-_w_a_y _c_o_n_t_i_n_g_e_n_c_y _t_a_b_l_e

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

     Entries in a table are plotted as rectangles proportional to the
     entry in the table. Width of rectangles are proportional to column
     totals, height proportional to entries within each column, hence
     areas are proportional to entries in the table.

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

       tabplot( M,
              col,
           border = "black",
              lwd = 2,
          collabs = TRUE,
          rowlabs = NULL,
            equal = FALSE,
              las = 1,
             main = NULL,
         cex.main = 1.0,
            vaxis = FALSE )

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

       M: Two-way table

     col: colors to use for coloring within each column. Defaults to a
          grayscale. May also be a function that takes an integer
          argument, as e.g. 'rainbow()'.

  border: color of borders around rectangles.

     lwd: width of the lines around rectangles.

 collabs: should colums be labelled.

 rowlabs: character "r" or "l": rows labelled on left or right side

   equal: should colums be plotted of equal width? If yes a plot
          similar to that obtainable from barplot is the result.

     las: how should labelling be rotated.

    main: heading for the plot

cex.main: character expansion for the heading.

   vaxis: should a vertical axis be drawn. If character it gives the
          side where it is drawn.

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

     The function offers a few more facilities for two-way tables than
     'mosaicplot', but is restricted to two-way tables as input.

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

     NULL. The function is used for its sideeffects.

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

     Bendix Carstensen, Steno Diabetes Center & Dept. of Biostatistics,
     University of Copenhagen bxc@steno.dk, <URL:
     http://www.pubhealth.ku.dk/~bxc>

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

     See Also 'barplot', 'plot.table', 'mosaicplot'

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

     b <- sample( letters[1:4], 300, replace=TRUE, prob=c(3,1,2,4)/10 )
     a <- rnorm( 300 ) - as.integer( factor( b ) ) / 8
     tb <- table( cut( a, -3:2 ), b )
     tabplot( tb )
     tabplot( tb, rowlabs="right", col=heat.colors )

     # Very similar plots
     ptb <- sweep( tb, 2, apply( tb, 2, sum ), "/" )
     par( mfrow=c(2,2) )
     barplot( ptb, space=0 )
     tabplot( tb, equal=TRUE, lwd=1 )
     tabplot( tb, equal=TRUE, lwd=1, rowlabs="l" )
     tabplot( tb, equal=FALSE, lwd=1, rowlabs="l" )

