Learn R Programming

ggsubplot (version 0.3.1.9000)

geom_subplot: Create a layer of embedded subplots

Description

Create a layer of embedded subplots

Usage

geom_subplot(mapping, width = rel(0.95), height = rel(0.95), data = waiver(), x_scale = identity, y_scale = identity, position = "identity", reference = NULL, ply.aes = TRUE, .ref = FALSE)

Arguments

mapping
An aesthetic mapping, usually constructed with aes. This mapping determines where in the major x and y axes each glyph will be position. Only x, y, group, and subplot aesthetics will be used. All other aesthetics will be ignored - consider placing them in the subplot's mapping instead.
width
numeric or rel object. The width of each glyph. If width is numeric, the glyph will be drawn with a width equal to width units on the x axis. If width is of class rel, glyph will attempt to assign an inuitive width based on the number of total glyphs and their placement within the plot. The width can be scaled relative to this intuitive width by changing the value of the rel object.
height
numeric or rel object. The height of each glyph. Height behaves the same way as width, but applies to the y dimension.
data
The dataframe the layer should map to. geom_subplot inherits the global dataframe defined in ggplot.
x_scale
function. The scaling to use for the x axis within each glyph. If x_scale equals identity(default), the x limits within each glyph will correspond to the range of x across all glyphs. This aids comparison because each glyph will use the same scale. If x_scale equals free, each glyph will use its own x scale. The limits of this scale will be set to the range of x values in that glyph.
y_scale
function. y_scale behaves the same as x_scale but controls the scales for the y axis within each glyph.
position
character. A string that specifies which position adjustment should be used. geom_subplot only recognizes "identity" and "merge".
reference
function. Function used to create reference objects for glyphs. If NULL, no reference objects are used. Reference objects are plotted on a layer beneath the glyphs. They provide a consistent frame of reference to aid comparisons between the glyphs. Functions that create reference objects include ref_box, ref_hline, and ref_vline.
ply.aes
logical. If TRUE (default) aesthetics are calculated separately for each group, as with ply_aes. If FALSE aesthetics are calculated based on entire data set for the layer.
.ref
internal argument used for plotting reference objects.

Value

an object of class sp_layer

Examples

Run this code
## Not run: ggplot(nasa) +
# map_americas +
# geom_subplot(aes(long, lat, group = id,
#   subplot = geom_point(aes(surftemp, temperature), size = 1/4))) +
# coord_map()
# ## End(Not run)

Run the code above in your browser using DataLab