plot.factor             package:graphics             R Documentation

_P_l_o_t_t_i_n_g _F_a_c_t_o_r _V_a_r_i_a_b_l_e_s

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

     This functions implements a scatterplot method for 'factor'
     arguments of the _generic_ 'plot' function.

     If 'y' is missing 'barplot' is produced. For numeric 'y' a
     'boxplot' is used, and for a factor 'y' a 'spineplot' is shown. 
     For any other type of 'y' the next 'plot' method is called,
     normally 'plot.default'.

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

     ## S3 method for class 'factor':
     plot(x, y, legend.text = NULL, ...)

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

    x, y: numeric or factor. 'y' may be missing.

legend.text: character vector for annotation of y axis in the case of a
          factor 'y': defaults to 'levels(y)'.  This sets the
          'yaxlabels' argument of 'spineplot'.

     ...: Further arguments to 'barplot', 'boxplot', 'spineplot' or
          'plot' as appropriate.  All of these accept graphical
          parameters, see 'par', and annotation arguments passed to
          'title'.  None accept 'type'. 

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

     'plot.default', 'plot.formula', 'barplot', 'boxplot', 'spineplot'.

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

     require(grDevices)
     plot(weight ~ group, data = PlantGrowth)         # numeric vector ~ factor
     plot(cut(weight, 2) ~ group, data = PlantGrowth) # factor ~ factor
     ## passing "..." to spineplot() eventually:
     plot(cut(weight, 3) ~ group, data = PlantGrowth,
          col = hcl(c(0, 120, 240), 50, 70))

     plot(PlantGrowth$group, axes=FALSE, main="no axes")# extremely silly

