scale_size {ggplot2}R Documentation

scale_size

Description

Size scale for continuous variable

Usage

scale_size(name=NULL, to=c(0.2, 3), ...)

Arguments

name name of scale to appear in legend or on axis
to numeric vector of length 2, giving minimum and maximum after transformation
... ignored

Details

This page describes scale_size, 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: 
    (p <- qplot(mpg, cyl, data=mtcars, size=cyl))
    p + scale_size("cylinders")
    p + scale_size("number\nof\ncylinders")
    
    p + scale_size(to = c(0, 10))
    p + scale_size(to = c(1, 2))

    # Map area, instead of width/radius
    # Perceptually, this is a little better
    p + scale_area()
    p + scale_area(to = c(1, 25))
    
    # Also works with factors, but not a terribly good
    # idea, unless your factor is ordered, as in this example
    qplot(mpg, cyl, data=mtcars, size=factor(cyl))
    
    # For lines, you need to tell that you want lines on the legend
    (p <- qplot(mpg, cyl, data=mtcars, size=cyl, geom="line"))
    p + scale_size(guide="line")
## End(Not run)

[Package ggplot2 version 0.6 Index]