scale_categorical {ggplot} | R Documentation

## Scale: general categorical

### Description

Create a categorical scale for the specified variable

### Usage

    scale_categorical(variable="x", name="", expand=c(0,0), transform="as.numeric", ...)

### Arguments

`variable` | variable that this scale is for
`name` | name of the scale (used in the legend)
`expand` | expansion factor for scale
`transform` | transformation function
`...` |

### Details

A categorical scale is a simple mapping from the levels of the categorical factor to values of the aesthetic attribute. These mappings are created by the aesthetic mapping functions `map_colour`, and `map_linetype`. You will want to refer to those to see the possible options that can be used to control the mapping.

You should not call this function yourself. Instead use:

- `pscategorical`
- `sccolour`
- `sclinetype`
- `scshape`

  If you use a continuous variable with this scale, it will automatically be converted to a categorical variable using `chop_auto`. If you want more control over the conversion you will want to use `chop` yourself. However, be careful to do all the chopping in one place, otherwise you may end up with different scales in different grobs.

  This categorical scale places evenly spaces the levels of the factor along the intergers. If you want to change the order of the levels you will need to change the levels in the original factor.

  ### Author(s)

  Hadley Wickham <h.wickham@gmail.com>

  ### Examples

  [Package ggplot version 0.4.2 Index]