View source: R/ggplot-geom-subrect.R
geom_subrect | R Documentation |
These geoms subdivide rectangles with shared borders into a grid. Both geoms achieve the same result but differ in how the rectangles are parameterized:
geom_subrect()
: Defines rectangles using their four corners (xmin
,
xmax
, ymin
, ymax
).
geom_subtile()
: Defines rectangles using the center (x
, y
) and
dimensions (width
, height
).
geom_subrect(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
byrow = FALSE,
nrow = NULL,
ncol = NULL,
lineend = "butt",
linejoin = "mitre",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
direction = deprecated()
)
geom_subtile(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
byrow = TRUE,
nrow = NULL,
ncol = NULL,
lineend = "butt",
linejoin = "mitre",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
direction = deprecated()
)
geom_subrect()
understands the following aesthetics (required aesthetics are in bold):
xmin
xmax
ymin
ymax
alpha
colour
fill
group
linetype
linewidth
Learn more about setting these aesthetics in vignette("ggplot2-specs", package = "ggplot2")
.
geom_subtile()
understands the following aesthetics (required aesthetics are in bold):
x
y
alpha
colour
fill
group
height
linetype
linewidth
width
Learn more about setting these aesthetics in vignette("ggplot2-specs", package = "ggplot2")
.
# arranges by row
ggplot(data.frame(value = letters[seq_len(5)])) +
geom_subtile(aes(x = 1, y = 1, fill = value), byrow = TRUE)
# arranges by column
ggplot(data.frame(value = letters[seq_len(9)])) +
geom_subtile(aes(x = 1, y = 1, fill = value))
# one-row
ggplot(data.frame(value = letters[seq_len(4)])) +
geom_subtile(aes(x = 1, y = 1, fill = value), nrow = 1)
# one-column
ggplot(data.frame(value = letters[seq_len(4)])) +
geom_subtile(aes(x = 1, y = 1, fill = value), ncol = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.