View source: R/annotation-gspace.R
| annotation_gspace_image | R Documentation |
annotation_gspace_image() adds an image annotation layer to a
ggplot-based GraphSpace plot.
annotation_gspace_image(
x,
interpolate = FALSE,
opacity = 1,
flip.v = FALSE,
flip.h = FALSE,
na.color = NA,
rgb_channels = c(1, 2, 3),
stretch = c("lin", "hist")
)
x |
An image to be displayed. Accepted types:
|
interpolate |
A logical value indicating whether to apply linear
interpolation when the image is rendered at a different resolution than
its native size. Defaults to |
opacity |
A numeric value in |
flip.v |
A logical value; if |
flip.h |
A logical value; if |
na.color |
The colour to map to NA values. Defaults to |
rgb_channels |
When a |
stretch |
When a |
A ggplot2 layer object that can be added to a ggplot()
call with +, or invisible(NULL) with a warning if the
image could not be resolved.
annotation_raster,
gs_image,
geom_nodespace,
geom_edgespace
library(RGraphSpace)
library(igraph)
# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')
gs <- GraphSpace(gtoy1)
# Normalize node coordinates
gs <- normalizeGraphSpace(gs)
# Add a raster image
gs_image(gs) <- as_colorraster(volcano)
# Pass a GraphSpace object directly
ggplot(gs) +
annotation_gspace_image(gs) +
geom_edgespace() +
geom_nodespace()
# Extract the image explicitly
ggplot(gs) +
annotation_gspace_image(gs_image(gs)) +
geom_edgespace() +
geom_nodespace()
# Dim the background and flip vertically
ggplot(gs) +
annotation_gspace_image(gs, opacity = 0.5, flip.v = TRUE) +
geom_edgespace() +
geom_nodespace()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.