scale_discrete {ggplot2}R Documentation

scale_discrete

Description

Discrete position scale

Usage

scale_x_discrete(name=NULL, expand=c(0, 0.75), labels=NULL, ...)
scale_y_discrete(name=NULL, expand=c(0, 0.75), labels=NULL, ...)
scale_z_discrete(name=NULL, expand=c(0, 0.75), labels=NULL, ...)

Arguments

name name of scale to appear in legend or on axis
expand numeric vector of length 2, giving multiplicative and additive expansion factors
labels character vector giving labels associated with breaks
... ignored

Details

This page describes scale_discrete, see layer and qplot for how to create a complete plot from individual components.

Value

A layer

Author(s)

Hadley Wickham, http://had.co.nz/

See Also

Examples

## Not run: 
    # The discrete position scale is added automatically whenever you
    # have a discrete position and the only thing you can do with it
    # is change the labels
    
    (d <- qplot(cut, clarity, data=diamonds, geom="jitter"))
    
    d + scale_x_discrete("Cut")
    d + scale_x_discrete("Cut", labels=c("F","G","VG","P","I"))
    d + scale_y_discrete("Clarity")
    d + scale_x_discrete("Cut") + scale_y_discrete("Clarity")
    
    # To adjust the order you must modify the underlying factor
    # see ?reorder for one approach to this    
## End(Not run)

[Package ggplot2 version 0.6 Index]