scale_size

scale_size(name=NULL, limits=NULL, breaks=NULL, labels=NULL, trans=NULL, to=c(1, 6), ...)

Size scale for continuous variable

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

What do you think of the documentation? Please let me know by filling out this short online survey.

Parameters

Parameters control the appearance of the scale. In addition to the parameters listed below (if any), any aesthetic can be used as a parameter, in which case it will override any aesthetic mapping.

Returns

This function returns a scale object.

See also

Examples

> (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)) 
  
>  
> # To control the size mapping for discrete variable, use 
> # scale_size_manual: 
> last_plot() + scale_size_manual(values=c(2,4,6)) 
  

What do you think of the documentation? Please let me know by filling out this short online survey.