| cropGraphSpace,GraphSpace-method | R Documentation |
Accessory functions to spatially transform a normalized
GraphSpace object. cropGraphSpace() subsets the plotting
area to a rectangular region; rotateGraphSpace() rotates by a
quarter turn; flipGraphSpace() mirrors horizontally or vertically;
transposeGraphSpace() swaps the x and y axes.
## S4 method for signature 'GraphSpace'
cropGraphSpace(gs, xmin = 0, xmax = 1, ymin = 0, ymax = 1, verbose = TRUE)
## S4 method for signature 'GraphSpace'
flipGraphSpace(gs, vertical = TRUE, persist = .is_raw(gs), verbose = TRUE)
## S4 method for signature 'GraphSpace'
rotateGraphSpace(gs, clockwise = TRUE, persist = .is_raw(gs), verbose = TRUE)
## S4 method for signature 'GraphSpace'
transposeGraphSpace(gs, persist = .is_raw(gs), verbose = TRUE)
gs |
A normalized |
xmin |
A single number in |
xmax |
A single number in |
ymin |
A single number in |
ymax |
A single number in |
verbose |
A single logical value specifying to display detailed
messages (when |
vertical |
Logical; if |
persist |
Logical; whether the transformation persists through
re-normalization. Defaults to |
clockwise |
Logical; if |
cropGraphSpace() subsets a normalized graph space to a specific
region defined by the cropping boundaries. It recalculates node positions
and background image boundaries to maintain spatial consistency after
cropping, and drops nodes (and edges) that fall outside the window.
rotateGraphSpace(), flipGraphSpace(), and
transposeGraphSpace() are all exact, a coordinate/pixel
permutation, with no resampling, no interpolation, and no risk of
misaligning nodes against the background image.
rotateGraphSpace() is restricted to a single 90-degree turn: apply
it again to its own output for 180 or 270 degrees. Combine all three with
each other to reach any of the 8 symmetries of a square.
A GraphSpace object with updated nodes
and canvas slots.
normalizeGraphSpace
library(RGraphSpace)
library(igraph)
# Create a star graph
gtoy1 <- make_full_graph(30)
# Create a GraphSpace
gs <- GraphSpace(gtoy1)
gs <- normalizeGraphSpace(gs)
gs_crop <- cropGraphSpace(gs, ymax = 0.5)
gs_rot90 <- rotateGraphSpace(gs)
gs_flip <- flipGraphSpace(gs)
gs_t <- transposeGraphSpace(gs)
plotGraphSpace(gs, node.labels = TRUE)
plotGraphSpace(gs_crop, node.labels = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.