View source: R/export-cartoons.R
| export_cartoons | R Documentation |
Draw and save one cartoon for each glycan structure in x.
export_cartoons(
x,
dirname,
...,
file_ext = "png",
dpi = 300,
scale = 1,
show_linkage = TRUE,
orient = c("H", "V"),
fuc_orient = c("flex", "up"),
red_end = "",
edge_linewidth = 0.8,
node_linewidth = 0.8,
node_size = 1,
colors = NULL,
style = NULL
)
x |
A |
dirname |
Directory name to save the cartoons. If it does not exist, it is created. |
... |
Ignored. |
file_ext |
File extension supported by |
dpi |
Deprecated and ignored. Use |
scale |
Numeric output-size multiplier passed to |
show_linkage |
Show glycosidic linkage annotations or not. Default is TRUE. Substituent annotations are always shown. |
orient |
The orientation of glycan structure. "H" for horizontal, "V" for vertical. Default is "H" |
fuc_orient |
Fuc-like triangle orientation. |
red_end |
Reducing-end annotation. The default |
edge_linewidth |
Numeric scalar controlling the linewidth of linkage
lines. Defaults to the current value, |
node_linewidth |
Numeric scalar controlling the linewidth of node
borders. Defaults to the current value, |
node_size |
Numeric scalar used as a multiplier for the default node
size. Defaults to |
colors |
Optional named character vector of custom monosaccharide fill
colors. Names must be supported monosaccharide names, such as |
style |
A |
The function returns the list of cartoons implicitly.
IUPAC-condensed nomenclatures are used as file names. If x is a named
character vector or named glyrepr::glycan_structure() vector, the vector
names are used as file names.
width and height?The familiar ggplot2::ggsave() interface uses width, height, and dpi
because ordinary ggplot2 plots are drawn into a user-chosen device size.
glydraw cartoons are different: the natural width and height are calculated
from the glycan structure so residues, linkages, labels, and borders stay
comparable across different glycans. If users supplied arbitrary width and
height, glydraw would either distort that structure-derived layout or need
to guess how to reconcile one requested size with the other.
dpi is also not the right control here because changing it alters how
point- and inch-based ggplot2 elements are rasterized relative to the fixed
cartoon canvas. glydraw therefore keeps an internal fixed design scale and
uses scale as a single multiplier for the final pixel dimensions. This
preserves the cartoon's aspect ratio and relative appearance while still
allowing larger or smaller output files.
export_cartoons(
c(
"Man(a1-3)Man(b1-4)GlcNAc(b1-",
"Gal(b1-4)GlcNAc(b1-"
),
tempdir()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.