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

