drag_network: Drag the nodes of a network to update the layout of the...

View source: R/drag-network.R

drag_networkR Documentation

Drag the nodes of a network to update the layout of the network

Description

Drag the nodes of a network to update the layout of the network

Usage

drag_network(p, g = NULL)

Arguments

p

the network diagram as a ggplot/gg/ggraph object.

g

an corresponding igraph object. Default is to extract from the 'ggraph' attribute.

Value

an updated ggplot/gg/ggraph object

Examples

## Not run: 
library(igraph)
library(ggraph)

flow_info <- data.frame(from = c(1,2,3,3,4,5,6),
                        to = c(5,5,5,6,7,6,7))
g = graph_from_data_frame(flow_info)
p <- ggraph(g, layout='nicely') + geom_node_point() + geom_edge_link() 
pp <- drag_network(p)

## End(Not run)

YuLab-SMU/enrichplot documentation built on April 15, 2024, 5:18 p.m.