Skip to contents

Re-expands each bin from StatSquareplot into one unit rectangle per observation, stacked. The rectangles are one unit tall in data units, so the y axis is a real count. Pair it with StatSquareplot in a ggplot2::layer() to draw the squares yourself, where a mapped fill stacks its groups within each bin.

Usage

GeomSquareplot

Format

A ggplot2::Geom object.

Details

The geom takes either a bin's edges (xmin/xmax, from ggplot2::stat_bin()) or a level's position plus a column width (x/width, from ggplot2::stat_count()), deriving the edges it was not given. Paired with stat = "count", it draws one countable column per category the way geom_bar() draws one bar.

The bars parameter chooses what a bin is drawn as, on one grid and in one layer: "none" draws the squares, "outline" frames them with the bar they add up to, and "solid" draws that bar with the squares covered over. The bar is derived from the squares rather than re-binned, so a bin holding no observations has no bar, and a solid bar stacks a mapped fill in the same spans its squares did. bar_color and bar_linewidth are the bar's own color and width; color and linewidth are the separators between the squares, and either may be mapped.

See also

gf_squareplot(), which pairs this stat and geom for you.