Skip to content
xuexue edited this page Jul 31, 2012 · 3 revisions

A scale defines how a given variable will be mapped to an aesthetic value: whether the mapping will be discrete, continuous, linear, logarithmic, etc.

  • gg.scale.id - identity scale (for when the data is already in the desired output)
  • gg.scale.continuous - continuous scale mapping from an interval to another interval
  • gg.scale.discrete - discrete scale mapping from a set of discrete values to points in an interval
  • gg.scale.palette - a color scale that maps from a discrete set of values to a set of colors
  • gg.scale.gradient - a color scale that maps from a continuous set of values to a range of colors
  • gg.scale.symbol - a discrete scale mapping from a set of discrete values to symbols

Initializes a scale. The following scales take optional parameters:

  • gg.scale.continuous(transform, min, max)
    • transform -- a function used on the input before it is mapped linearly to the output. For now, continuous scales supports linear, log and sqrt transforms.
    • min -- force a minimum value on the domain of the scale. This will change the area being plotted, as well as the axis.
    • max -- force a maximum value on the domain of the scale. This will change the area being plotted, as well as the axis.
  • gg.scale.palette(palette)
    • palette -- a name of a colorbrewer palette to use.
  • gg.scale.gradient(low, high)
    • low -- the color that the min value of the domain will be mapped to
    • high -- the color that the max value of the domain will be mapped to

Clone this wiki locally