View source: R/geom-squareplot.R
| geom_squareplot | R Documentation |
geom_squareplot() and stat_squareplot() expose gf_squareplot() through
ggplot2 syntax. With the default bars = "none", each observation is drawn
as one square. Continuous x values use ggplot2::stat_bin()'s binning rules;
factors, characters, and logicals use ggplot2::stat_count()'s columns.
Both constructors retain gf_squareplot()'s defaults, warnings, factor-level
handling, and count scale.
Counts must be finite, nonnegative whole numbers. Integer frequency weights
are supported; use a histogram or bar plot for fractional weighted counts.
Fill and separator colour inherit mappings, with teal and white defaults
when no mapping or fixed value is supplied.
Put a staged linewidth = after_scale(...) mapping on this layer to keep
its width fixed. Plot-level after_scale() linewidth mappings use automatic
border fitting: ggplot2 evaluates them after the geom's setup.
geom_squareplot(
mapping = NULL,
data = NULL,
stat = "squareplot",
position = "identity",
...,
binwidth = NULL,
bins = NULL,
center = NULL,
boundary = NULL,
closed = NULL,
breaks = NULL,
bars = "none",
na.rm = TRUE,
show.legend = NA,
inherit.aes = TRUE
)
stat_squareplot(
mapping = NULL,
data = NULL,
geom = "squareplot",
position = "identity",
...,
binwidth = NULL,
bins = NULL,
center = NULL,
boundary = NULL,
closed = NULL,
breaks = NULL,
bars = "none",
na.rm = TRUE,
show.legend = NA,
inherit.aes = TRUE
)
mapping |
Aesthetic mappings created by |
data |
A data frame for this layer, or |
stat |
The statistical transformation used by |
position, show.legend, inherit.aes |
See |
... |
Fixed aesthetics and other layer parameters. These include |
binwidth, bins, center, boundary, closed, breaks |
Binning parameters with
the meanings used by |
bars |
Display style: |
na.rm |
Must be |
geom |
The geometric object used by |
A squareplot is x-only, as it is through gf_squareplot(). Map the
distribution to x. If the plot already maps y for another layer, set
inherit.aes = FALSE and supply this layer's x mapping directly.
A ggplot2 layer.
gf_squareplot()
ggplot2::ggplot(Fingers, ggplot2::aes(Thumb)) +
geom_squareplot()
ratings <- data.frame(rating = factor(c(1, 1, 3), levels = 1:5))
ggplot2::ggplot(ratings, ggplot2::aes(rating)) +
stat_squareplot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.