sieveplot                package:vcd                R Documentation

_S_i_e_v_e _P_l_o_t_s

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

     Visualization of two-way contingency tables: plots rectangles with
     areas proportional to the expected cell frequencies and filled
     with a number of squares equal to the observed frequencies.  Thus,
     the densities visualize the deviations of the observed from the
     expected values.

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

     ## Default S3 method:
     sieveplot(x, reverse_y = TRUE, type = c("observed", "expected"),
       main = deparse(substitute(x)),
       values = c("none", "cells", "margins", "both"),
       frequencies = c("absolute", "relative"),
       sieve_colors = c("red","blue"),
       sieve_lty = c("longdash", "solid"), exp_color = "gray",
       exp_lty = "dotted", margin = 0.01, newpage = TRUE, pop = TRUE,
       margins = c(4,3,4,4), xlab = names(dimnames(x))[2],
       ylab = names(dimnames(x))[1], ...)
     ## S3 method for class 'formula':
     sieveplot(formula, data = NULL, ..., subset)

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

       x: a two-way contingency table, as generated by 'table'.

reverse_y: logical; if 'TRUE', the y axis is reversed (i.e., the
          rectangles' positions correspond to the contingency table).

    type: switch indicating whether rectangles should be filled
          according to 'observed' or 'expected' frequencies.

    main: character string specifying the title.

  values: switch indicating whether the frequencies of 'cells' or
          'margins' or of 'both' should be plotted.

frequencies: switch indicating the type of these frequencies:
          'relative' or 'absolute'.

sieve_colors, sieve_lty: vectors with up to two color/line type
          entries: the first is used for negative and the second for
          positive deviations from the expected frequencies.

exp_color, exp_lty: color/line type entry for the expected values grid.

  margin: lines of margin between the cell rectangles.

 margins: vector of margins (see 'par').

 newpage: logical; if 'TRUE', the plot is drawn on a new page.

     pop: logical; if 'TRUE', all newly generated viewports are popped
          after plotting.

xlab, ylab: labels of x- and y-axis.

 formula: a formula, such as 'y ~ x'. For details, see 'xtabs'.

    data: a data frame (or list), or a contingency table from which the
          variables in 'formula' should be taken.

  subset: an optional vector specifying a subset of the rows in the
          data frame to be used for plotting.

     ...: further graphics parameters (see 'gpar').

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

     David Meyer David.Meyer@R-project.org

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

     H. Riedwyl & M. Schpbach (1994), Parquet diagram to plot
     contingency tables. In F. Faulbaum (ed.), _Softstat '93: Advances
     in Statistical Software_, 293-299. Gustav Fischer, New York.

     M. Friendly (2000), Visualizing Categorical Data, SAS Institute,
     Cary, NC.

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

     'mosaic'

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

     data(HairEyeColor)

     ## aggregate over 'sex':
     (tab <- margin.table(HairEyeColor, c(2,1)))

     ## plot expected values:
     sieveplot(tab, type = "expected", values = "both")

     ## plot sieve diagram:
     sieveplot(tab)

     ## an example for the formula interface:
     data(VisualAcuity)
     sieveplot(Freq ~ right + left,  data = VisualAcuity, reverse_y = FALSE)

