| save_cartoon | R Documentation |
This function saves the glycan cartoon to a file, with a suitable size.
save_cartoon(cartoon, file, ..., dpi = 300, scale = 1)
cartoon |
A ggplot2 object returned by |
file |
File name of glycan cartoon. |
... |
Ignored. |
dpi |
Deprecated and ignored. Use |
scale |
Numeric output-size multiplier. The default |
Path of the saved cartoon file.
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.
cartoon <- draw_cartoon("Gal(b1-3)GalNAc(a1-")
save_cartoon(cartoon, tempfile(fileext = ".png"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.