pscategorical             package:ggplot             R Documentation

_P_o_s_i_t_i_o_n: _c_a_t_e_g_o_r_i_c_a_l

_D_e_s_c_r_i_p_t_i_o_n:

     Add a categorical position scale to the plot

_U_s_a_g_e:

     pscategorical(plot = .PLOT, variable="x", name="", expand=c(0.01, 0.6))

_A_r_g_u_m_e_n_t_s:

    plot: ggplot object

variable: axis ("x" or "y")

    name: name of the scale (used in the legend)

  expand: expansion vector (numeric vector, multiplicative and additive
          expansion).  Defaults to adding 0.6 on either end of the
          scale.

_D_e_t_a_i_l_s:

     A categorical scale converts a factor into a numerical
     representation very simply: by using 'as.numeric'.  This means
     that levels will be placed a integer locations in the same order
     that they appear in the levels of the factor (see 'levels').

     If you want to reorder (or combine) categories, currently the best
     way to do this is to modify the original factors.  In a future
     version of ggplot I will probably expand the categorical scale so
     that you can do that here.

     This scale is added to the plot automatically when you use a
     categorical variable in the x or y aesthetics.  You shouldn't need
     to to call this function unless (for some reason) you want to
     change the expansion factor.

_A_u_t_h_o_r(_s):

     Hadley Wickham <h.wickham@gmail.com>

_E_x_a_m_p_l_e_s:

     p <- ggpoint(ggplot(mtcars, aesthetics=list(x=cyl, y=mpg)))
     pscategorical(p, "x") # no change, because already categorical
     pscategorical(p, "y") # chops into discrete segments

