rotate_layout {GephiForR} | R Documentation |
Rotate layout positions by a custom angle
Description
This function rotates each node's position by a specified angle.
Usage
rotate_layout(layout, angle)
Arguments
layout |
A 2-column matrix or dataframe of position data, where the columns are the x- and y-coordinates of each node, respectively. |
angle |
The angle by which to rotate the layout, in degrees. |
Details
This function rotates each node position in a 2-column matrix/dataframe of position data by a specified angle.
Value
A matrix of node positions.
Examples
# Create a random graph
library(igraph)
g <- erdos.renyi.game(100, 0.05)
# Initializing position vector and plotting
position <- as.matrix(data.frame(X = c(1, 2, 3), Y = c(4, 5, 6)))
plot(g, layout = position)
# Rotating position vector 90 degrees and plotting
rotated_df <- rotate_layout(position, 90)
plot(g, layout = rotated_df)
# Rotating position vector 283 degrees and plotting
rotated_df <- rotate_layout(position, 283)
plot(g, layout = rotated_df)
[Package GephiForR version 0.1.0 Index]