Title: | Draw Network with Data |
---|---|
Description: | Extends the 'ggplot2' plotting system to support network visualization. Inspired by 'ggtree', 'ggtangle' is designed to work with network associated data. |
Authors: | Guangchuang Yu [aut, cre] |
Maintainer: | Guangchuang Yu <[email protected]> |
License: | Artistic-2.0 |
Version: | 0.0.3 |
Built: | 2024-10-25 05:28:38 UTC |
Source: | CRAN |
category-item network plot
cnetplot( x, layout = igraph::layout_nicely, showCategory = 5, color_category = "#E5C494", size_category = 1, color_item = "#B3B3B3", size_item = 1, color_edge = "grey", size_edge = 0.5, node_label = "all", foldChange = NULL, hilight = "none", hilight_alpha = 0.3, ... ) ## S3 method for class 'list' cnetplot( x, layout = igraph::layout_nicely, showCategory = 5, color_category = "#E5C494", size_category = 1, color_item = "#B3B3B3", size_item = 1, color_edge = "grey", size_edge = 0.5, node_label = "all", foldChange = NULL, hilight = "none", hilight_alpha = 0.3, ... )
cnetplot( x, layout = igraph::layout_nicely, showCategory = 5, color_category = "#E5C494", size_category = 1, color_item = "#B3B3B3", size_item = 1, color_edge = "grey", size_edge = 0.5, node_label = "all", foldChange = NULL, hilight = "none", hilight_alpha = 0.3, ... ) ## S3 method for class 'list' cnetplot( x, layout = igraph::layout_nicely, showCategory = 5, color_category = "#E5C494", size_category = 1, color_item = "#B3B3B3", size_item = 1, color_edge = "grey", size_edge = 0.5, node_label = "all", foldChange = NULL, hilight = "none", hilight_alpha = 0.3, ... )
x |
input object |
layout |
network layout |
showCategory |
selected category to be displayed |
color_category |
color of category node |
size_category |
relative size of the category |
color_item |
color of item node |
size_item |
relative size of the item (e.g., genes) |
color_edge |
color of edge |
size_edge |
relative size of edge |
node_label |
one of 'all', 'none', 'category' and 'item' |
foldChange |
numeric values to color the item (e.g, foldChange of gene expression values) |
hilight |
selected category to be highlighted |
hilight_alpha |
transparent value for not selected to be highlight |
... |
additional parameters |
Drag the nodes of a network to update the layout of the network
drag_network(p, g = NULL)
drag_network(p, g = NULL)
p |
the network diagram as a ggplot/gg/ggraph object. |
g |
an corresponding igraph object. Default is to extract from the 'ggraph' attribute. |
an updated ggplot/gg/ggraph object
## 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)
## 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)
layer to draw edges of a network
geom_edge(mapping = NULL, data = NULL, geom = geom_segment, ...)
geom_edge(mapping = NULL, data = NULL, geom = geom_segment, ...)
mapping |
aesthetic mapping, default is NULL |
data |
data to plot, default is NULL |
geom |
geometric layer to draw lines |
... |
additional parameter passed to 'geom' |
line segments layer
flow_info <- data.frame(from = LETTERS[c(1,2,3,3,4,5,6)], to = LETTERS[c(5,5,5,6,7,6,7)]) dd <- data.frame( label = LETTERS[1:7], v1 = abs(rnorm(7)), v2 = abs(rnorm(7)), v3 = abs(rnorm(7)) ) g = igraph::graph_from_data_frame(flow_info) p <- ggplot(g) + geom_edge() library(ggplot2) library(scatterpie) p %<+% dd + geom_scatterpie(cols = c("v1", "v2", "v3")) + geom_text(aes(label=label), nudge_y = .2) + coord_fixed()
flow_info <- data.frame(from = LETTERS[c(1,2,3,3,4,5,6)], to = LETTERS[c(5,5,5,6,7,6,7)]) dd <- data.frame( label = LETTERS[1:7], v1 = abs(rnorm(7)), v2 = abs(rnorm(7)), v3 = abs(rnorm(7)) ) g = igraph::graph_from_data_frame(flow_info) p <- ggplot(g) + geom_edge() library(ggplot2) library(scatterpie) p %<+% dd + geom_scatterpie(cols = c("v1", "v2", "v3")) + geom_text(aes(label=label), nudge_y = .2) + coord_fixed()