geom_area

Area plots

Details

An area plot is the continuous analog of a stacked bar chart (see geom_bar), and can used to show how composition of the whole varies over the range of x. Choosing the order in which different components is stacked is very important, as it becomes increasing hard to see the indivudual pattern as you move up the stack.

An area plot is a special case of geom_ribbon, where the minimum of the range is fixed to 0, and the position adjustment defaults to position_stacked.

See layer and qplot for more information on creating a complete plot from multiple components.

Aesthetics

The following aesthetics can be used with geom_area. They are listed along with their default value. All geoms and scales can also use the group aesthetic. Read how this important aesthetic works in scale_group. Typically, you will associate an aesthetic with a variable in your data set. To do this, you use the aes function: geom_area(aes(x = var)). Scales control the details of the mapping between data and aesthetic properties; after each aesthetic are listed scales that can be used with that aesthetic. The scale documentation will also provide references to help you interpret the default values.

Instead of mapping an aesthetic to a variable in your dataset, you can also set it to a fixed value. See the parameters section for details.

Parameters

When an aesthetic is used an a parameter, like geom_area(colour = 3), it will override mappings from data.

Default statistic

stat_identity. Override with the stat argument: geom_area(stat="identity")

Default position

position_stack. Override with the position argument: geom_area(position="jitter").

See also