\HeaderA{pscategorical}{Position: categorical}{pscategorical}
\keyword{hplot}{pscategorical}
\begin{Description}\relax
Add a categorical position scale to the plot
\end{Description}
\begin{Usage}
\begin{verbatim}pscategorical(plot = .PLOT, variable="x", expand=c(0, 0.55))\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{plot}] ggplot object
\item[\code{variable}] axis ("x" or "y")
\item[\code{expand}] expansion vector (numeric vector, multiplicative and additive expansion).  Defaults to adding 0.5 on either end of the scale.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
A categorical scale converts a factor into a numerical representation
very simply: by using \code{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 \code{\LinkA{levels}{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.
\end{Details}
\begin{Author}\relax
Hadley Wickham <h.wickham@gmail.com>
\end{Author}
\begin{Examples}
\begin{ExampleCode}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\end{ExampleCode}
\end{Examples}

