scale_discrete {ggplot2} | R Documentation |
Discrete position scale
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, ...)
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 |
This page describes scale_discrete, see layer
and qplot
for how to create a complete plot from individual components.
A layer
Hadley Wickham, http://had.co.nz/
## 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)