geom_col {ggplot2} R Documentation

Bar charts

Description


There are two types of bar charts: geombar() and geomcol(). geombar()
makes the height of the bar proportional to the number of cases in each
group (or if the weight aesthetic is supplied, the sum of the weights).
If you want the heights of the bars to represent values in the data, use
geom
col() instead. geombar() uses statcount() by default: it counts
the number of cases at each x position. geomcol() uses statidentity():
it leaves the data as is.

Usage

geom_col(
    mapping = NULL,
    data = NULL,
    position = "stack",
    just = 0.5,
    width = 0,
    na.rm = FALSE,
    show.legend = NULL,
    inherit.aes = TRUE,
    args = NULL);

Arguments

mapping

Set of aesthetic mappings created by aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer. There are three options: If NULL, the Default, the data Is inherited from the plot data As specified In the Call To ggplot(). A data.frame, Or other Object, will override the plot data. All objects will be fortified To produce a data frame. See fortify() For which variables will be created. A Function will be called With a Single argument, the plot data. The Return value must be a data.frame, And will be used As the layer data. A Function can be created from a formula (e.g. ~ head(.x, 10)).

position

Position adjustment, either as a string naming the adjustment (e.g. "jitter" to use position_jitter), or the result of a call to a position adjustment function. Use the latter if you need to change the settings of the adjustment.

just

Adjustment for column placement. Set to 0.5 by default, meaning that columns will be centered about axis breaks. Set to 0 or 1 to place columns to the left/right of axis breaks. Note that this argument may have unintended behaviour when used with alternative positions, e.g. position_dodge(). [as double]

width

Bar width. By default, set to 90% of the resolution() of the data. [as double]

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed. [as boolean]

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. [as boolean]

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders(). [as boolean]

args

Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3. They may also be parameters to the paired geom/stat. [as list]

env

[as Environment]

Details

Authors

SMRUCC genomics institute

Value

this function returns data object of type any kind.

clr value class

Examples


[Package ggplot2 version 1.0.0.0 Index]