ggmark | R Documentation |
Add a plot to annotate selected observations
ggmark(
mark,
data = waiver(),
mapping = aes(),
...,
group1 = NULL,
group2 = NULL,
obs_size = 1,
size = NULL,
active = NULL
)
mark |
A |
data |
The following options can be used:
|
mapping |
Default list of aesthetic mappings to use for plot. If not specified, must be supplied in each layer added to the plot. |
... |
<dyn-dots> Additional arguments passed to
|
group1 , group2 |
A single boolean value indicating whether to use the
panel group information from the layout as the paired groups. By default,
if no specific observations are selected in |
obs_size |
A single numeric value that indicates the size of a single
observation, ranging from |
size |
The relative size of the plot, can be specified as a
|
active |
A |
ggmark
initializes a ggplot object. The underlying data is created using
fortify_data_frame()
. Please refer to it for more details.
In addition, the following columns will be added to the data frame:
.panel
: the panel for the aligned axis. It means x-axis
for vertical
stack layout (including top and bottom annotation), y-axis
for
horizontal stack layout (including left and right annotation).
.names
(vec_names()
) and .index
(vec_size()
/NROW()
): a character names (only
applicable when names exists) and an integer of index of the original
data.
.hand
: A factor with levels c("left", "right")
for horizontal stack
layouts, or c("top", "bottom")
for vertical stack layouts, indicating
the position of the linked observations.
set.seed(123)
small_mat <- matrix(rnorm(56), nrow = 7)
rownames(small_mat) <- paste0("row", seq_len(nrow(small_mat)))
colnames(small_mat) <- paste0("column", seq_len(ncol(small_mat)))
# mark_line
ggheatmap(small_mat) +
theme(axis.text.x = element_text(hjust = 0, angle = -60)) +
anno_right() +
align_kmeans(3L) +
ggmark(mark_line(I(1:3) ~ NULL)) +
geom_boxplot(aes(.names, value)) +
theme(plot.margin = margin(l = 0.1, t = 0.1, unit = "npc"))
# mark_tetragon
ggheatmap(small_mat) +
theme(axis.text.x = element_text(hjust = 0, angle = -60)) +
anno_right() +
align_kmeans(3L) +
ggmark(mark_tetragon(I(1:3) ~ NULL)) +
geom_boxplot(aes(.names, value)) +
theme(plot.margin = margin(l = 0.1, t = 0.1, unit = "npc"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.