graphModplot | R Documentation |
Interactively modify the plot of a graph object by manually changing the location where vertices are being placed.
graphModplot(
x,
col = "grey80",
bg = c("red", "black", "blue"),
pch = 21L,
length = 0.05,
pt.cex = 0.75,
...
)
x |
A |
col |
Color of the arrows representing the edges. Default is
|
bg |
Background colors for the origin, intermediate, and terminal
vertices, respectively. Default is |
pch |
Plotting 'character' (see |
length |
Length of the edge of the arrow head (see
|
pt.cex |
The relative point size used for the vertex markers. The
default value is |
... |
Additional parameters to be passed to other functions of methods. |
After calling the function, a mouse-click on the display will select the nearest vertex. Which one has been selected is indicated by the background of its marker turning white, with its incoming edges appearing as red dashed segments and its outgoing edges appearing as blue dashed segments. A second mouse-click will cause the vertex to be relocated at the location of the mouse pointer.
A point geometry object.
Guillaume Guénard [aut, cre] (<https://orcid.org/0000-0003-0761-3072>), Pierre Legendre [ctb] (<https://orcid.org/0000-0002-3838-3305>) Maintainer: Guillaume Guénard <guillaume.guenard@umontreal.ca>
graph-class
.
## Create an exemplary graph:
data.frame(
species = rep(TRUE,13),
type = c(2,2,3,1,2,2,2,2,2,2,3,3,3),
x = c(1,3,4,0,1.67,4,1,1.33,2.33,3.33,4.33,4,5),
y = c(1,1,1,0,0.5,0,-1,0,0,-0.5,-1,-0.5,-0.5),
row.names = sprintf("V%d",1:13)
) %>%
st_as_sf(
coords=c("x","y"),
crs = NA
) %>%
graph %>%
add.edge(
from = c(1,2,1,5,4,4,5,9,4,8,9,4,7,7,6,6,9,10,10),
to = c(2,3,5,2,1,5,9,2,8,9,6,7,8,9,3,13,10,12,11),
data = data.frame(
distance = c(4.2,4.7,3.9,3.0,3.6,2.7,4.4,3.4,3.6,3.3,
4.8,3.2,3.5,4.4,2.5,3.4,4.3,3.1,2.2),
row.names = sprintf("E%d",1:19)
)
) -> x
## Original coordinates:
plot(x)
## Edit the vertex locations manually:
x <- graphModplot(x)
## Plot with the new coordinates
plot(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.