View source: R/geom-node-glycan.R
| geom_node_glycan | R Documentation |
geom_node_glycan() is a ggraph node layer backed by
geom_glycan(). It supplies the node layout's x and y columns as the
default position aesthetics and supports ggraph's filter aesthetic.
geom_node_glycan(
mapping = NULL,
data = NULL,
position = "identity",
show.legend = NA,
...
)
mapping |
Set of aesthetic mappings created by |
data |
The node data to display. When |
position |
A position adjustment. Defaults to |
show.legend |
Logical. Should this layer be included in legends? |
... |
Arguments passed to |
A ggplot2 layer that can be added to a ggraph::ggraph() plot.
geom_node_glycan() understands the same aesthetics as geom_glycan().
structure is required, while x and y default to the node layout
coordinates. It additionally supports filter, a logical aesthetic that
selects which nodes are drawn.
if (requireNamespace("ggraph", quietly = TRUE)) {
graph <- igraph::make_ring(2)
igraph::V(graph)$glycan <- c(
"GalNAc(a1-",
"Gal(b1-3)GalNAc(a1-"
)
ggraph::ggraph(graph, layout = "linear") +
ggraph::geom_edge_link() +
geom_node_glycan(ggplot2::aes(structure = .data$glycan))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.