Description Usage Arguments Details Value Examples
geom_subplot bins data into a two dimensional grid and then visualizes the data within each bin with an embedded subplot. Mappings, stat, and parameters are applied consistently across subplots, but each subplot only uses the data that falls withn its 2d bin.
1 2 3 4 |
mapping |
An aesthetic mapping, usually constructed with
|
bins |
numeric. The number of bins to divide each major axis into. If bins is of length 2, the first number will be applied to the x axis and the second to the y. Defaults to 10. |
binwidth |
numeric. The binwidth to use when dividing the major x and y axes into bins. If set, binwidth will override the bins argument. If binwidth is of length 2, the first number will be applied to the x axis and the second to the y. Defaults to NULL. |
breaks |
a vector of breaks or a function from the densityvis package (unpublished), such as interval_breaks. breaks determines which breaks are used to bin the x and y axes. If set, breaks will override the bins and binwidth arguments. If breaks is a list, the first element will be applied to the x axis and the second to the y. Defaults to NULL. |
data |
The dataframe the layer should map to. geom_subplot2d inherits the
global dataframe defined in |
x_scale |
function. The scaling to use for the x axis within each glyph.
If x_scale equals |
y_scale |
function. y_scale behaves the same as x_scale but controls the scales for the y axis within each glyph. |
width.adjust |
numeric. The proportion of horizontal space within a grid box that each subplot should occupy. Used to control overlapping and appearance. Each subplot is anchored to the bottom left corner of the grid box and then spans the proportion of the box specified by width adjust. |
height.adjust |
numeric. The proportion of vertical space within a grid box that each subplot should occupy. Behaves the same as width.adjust. |
position |
character. "identity" |
reference |
function. Function used to create reference objects for
the embedded plots. If NULL, no reference objects are used. Reference objects
are plotted on a layer beneath the subplots. They provide a consistent frame
of reference to aid comparisons across subplots. Functions that create
reference objects include |
ply.aes |
logical. If TRUE (default) aesthetics are calculated
separately for each subplot, as with |
.ref |
internal argument used for plotting reference objects. |
Any variables in the data set may be used as x and y axes to bin on. These 'major' x and y axes need not correspond to the 'minor' x and y axes within each subplot. Minor x and y axes are defined in the subplot aesthetic of geom_subplot2d. To allow interpretation, the major axes of a gridded layer should correspond to the x and y aesthetics for any other (non - gridded) layers in the plot.
an object of class glayer
1 2 3 4 5 6 7 8 9 | ## Not run:
ggplot(casualties) +
map_afghanistan +
geom_subplot2d(aes(lon, lat,
subplot = geom_bar(aes(victim, ..count.., fill = victim))),
bins = c(15,12), ref = NULL, width = rel(0.8)) +
coord_map()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.