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", expand=c(0, 0.55))

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

    plot: ggplot object

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

  expand: expansion vector (numeric vector, multiplicative and additive
          expansion).  Defaults to adding 0.5 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

