| scale_x_glycan | R Documentation |
scale_x_glycan() and scale_y_glycan() are discrete position scales that
replace text tick labels with compact glycan cartoons. Mapped discrete values
and values returned by the scale's labels argument may be glycan structure
strings supported by glyparse::auto_parse() or
glyrepr::glycan_structure() vectors. X-axis cartoons are vertical and
bottom-aligned by default, while y-axis cartoons are horizontal and
right-aligned by default. The cartoon orientation and alignment adapt to the
displayed axis, including when the axes are swapped by
ggplot2::coord_flip().
scale_x_glycan(
name = ggplot2::waiver(),
...,
palette = seq_len,
expand = ggplot2::waiver(),
position = "bottom",
sec.axis = ggplot2::waiver(),
continuous.limits = NULL,
size = 0.4,
angle = 0,
hjust = hjust_red_end(),
vjust = 0,
nudge_x = 0,
nudge_y = 0,
show_linkage = TRUE,
red_end = "",
fuc_orient = c("flex", "up"),
edge_linewidth = 0.8,
node_linewidth = 0.8,
node_size = 1,
colors = NULL,
style = NULL
)
scale_y_glycan(
name = ggplot2::waiver(),
...,
palette = seq_len,
expand = ggplot2::waiver(),
position = "left",
sec.axis = ggplot2::waiver(),
continuous.limits = NULL,
size = 0.4,
angle = 0,
hjust = 1,
vjust = vjust_red_end(),
nudge_x = 0,
nudge_y = 0,
show_linkage = TRUE,
red_end = "",
fuc_orient = c("flex", "up"),
edge_linewidth = 0.8,
node_linewidth = 0.8,
node_size = 1,
colors = NULL,
style = NULL
)
name |
The name of the scale, displayed as the axis title. Use |
... |
Arguments passed to |
palette |
A palette function that returns discrete position values. |
expand |
Expansion applied to the discrete position scale. |
position |
Position of the axis. |
sec.axis |
A secondary axis specification. |
continuous.limits |
Continuous limits used to position the discrete scale. |
size |
Positive scalar that uniformly scales each axis-label cartoon.
Defaults to |
angle |
Rotation in degrees applied to each axis-label cartoon,
independently of the cartoon orientation. Defaults to |
hjust |
Horizontal justification. Vertical x-axis cartoons default to
|
vjust |
Vertical justification. Vertical x-axis cartoons default to
|
nudge_x |
Horizontal adjustment of each cartoon, in millimetres.
Positive values move cartoons to the right. When this moves cartoons
toward or away from a y-axis title, the title moves with them to preserve
the gap. Defaults to |
nudge_y |
Vertical adjustment of each cartoon, in millimetres. Positive
values move cartoons upward. When this moves cartoons toward or away from
an x-axis title, the title moves with them to preserve the gap. Defaults
to |
show_linkage |
Whether to show glycosidic linkage annotations inside
the cartoons. Defaults to |
red_end |
Reducing-end annotation passed to |
fuc_orient |
Fuc-like triangle orientation passed to |
edge_linewidth |
Linkage linewidth passed to |
node_linewidth |
Node-border linewidth passed to |
node_size |
Node-size multiplier passed to |
colors |
Optional named character vector of monosaccharide fill colors
passed to |
style |
A |
A ggplot2 discrete position scale.
glycans <- data.frame(
structure = c(
"Gal(b1-3)GalNAc(a1-",
"Man(a1-3)[Man(a1-6)]Man(b1-4)GlcNAc(b1-"
),
abundance = c(12, 8)
)
ggplot2::ggplot(glycans, ggplot2::aes(x = structure, y = abundance)) +
ggplot2::geom_col() +
scale_x_glycan()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.