plotGraph | R Documentation |
SummarizedExperiment
plotGraph
plots an igraph
object with additional information
matched from a SummarizedExperiment
object for the nodes only.
Information on the edges have to provided manually.
plotColGraph(x, y, ...)
plotRowGraph(x, y, ...)
## S4 method for signature 'ANY,SummarizedExperiment'
plotColGraph(
x,
y,
show.label = show_label,
show_label = FALSE,
add.legend = add_legend,
add_legend = TRUE,
layout = "kk",
edge.type = edge_type,
edge_type = c("fan", "link", "arc", "parallel"),
edge.colour.by = edge_colour_by,
edge_colour_by = NULL,
edge.width.by = edge_width_by,
edge_width_by = NULL,
colour.by = colour_by,
colour_by = NULL,
shape.by = shape_by,
shape_by = NULL,
size.by = size_by,
size_by = NULL,
assay.type = by_exprs_values,
by_exprs_values = "counts",
other.fields = other_fields,
other_fields = list(),
...
)
## S4 method for signature 'SummarizedExperiment,missing'
plotColGraph(x, y, name = "graph", ...)
## S4 method for signature 'ANY,SummarizedExperiment'
plotRowGraph(
x,
y,
show.label = show_label,
show_label = FALSE,
add.legend = add_legend,
add_legend = TRUE,
layout = "kk",
edge.type = edge_type,
edge_type = c("fan", "link", "arc", "parallel"),
edge.colour.by = edge_colour_by,
edge_colour_by = NULL,
edge.width.by = edge_width_by,
edge_width_by = NULL,
colour.by = colour_by,
colour_by = NULL,
shape.by = shape_by,
shape_by = NULL,
size.by = NULL,
assay.type = by_exprs_values,
by_exprs_values = "counts",
other.fields = other_fields,
other_fields = list(),
...
)
## S4 method for signature 'SummarizedExperiment,missing'
plotRowGraph(x, y, name = "graph", ...)
x , y |
a graph object and a
|
... |
additional arguments for plotting. See
|
show.label |
|
show_label |
Deprecated. Use |
add.legend |
|
add_legend |
Deprecated. Use |
layout |
|
edge.type |
|
edge_type |
Deprecated. Use |
edge.colour.by |
|
edge_colour_by |
Deprecated. Use |
edge.width.by |
|
edge_width_by |
Deprecated. Use |
colour.by |
|
colour_by |
Deprecated. Use |
shape.by |
|
shape_by |
Deprecated. Use |
size.by |
|
size_by |
Deprecated. Use |
assay.type |
|
by_exprs_values |
Deprecated. Use |
other.fields |
Additional fields to include in the node information without plotting them. |
other_fields |
Deprecated. Use |
name |
|
Internally tidygraph
and ggraph
are used. Therefore, all
graph types which can be converted by tidygraph::as_tbl_graph
can
be used.
a ggtree
plot
# data setup
library(mia)
data(GlobalPatterns)
data(col_graph)
data(row_graph)
data(row_graph_order)
metadata(GlobalPatterns)$col_graph <- col_graph
genus <- agglomerateByRank(GlobalPatterns,"Genus",na.rm=TRUE)
metadata(genus)$row_graph <- row_graph
order <- agglomerateByRank(genus,"Order",na.rm=TRUE)
metadata(order)$row_graph <- row_graph_order
# plot a graph independently
plotColGraph(col_graph,
genus,
colour.by = "SampleType",
edge.colour.by = "weight",
edge.width.by = "weight",
show.label = TRUE)
# plot the graph stored in the object
plotColGraph(genus,
name = "col_graph",
colour.by = "SampleType",
edge.colour.by = "weight",
edge.width.by = "weight")
# plot a graph independently
plotRowGraph(row_graph,
genus,
colour.by = "Kingdom",
edge.colour.by = "weight",
edge.width.by = "weight")
# plot the graph stored in the object
plotRowGraph(genus,
name = "row_graph",
colour.by = "Phylum",
edge.colour.by = "weight",
edge.width.by = "weight")
# plot a graph independently
plotRowGraph(row_graph_order,
order,
colour.by = "Kingdom",
edge.colour.by = "weight",
edge.width.by = "weight")
# plot the graph stored in the object and include some labels
plotRowGraph(order,
name = "row_graph",
colour.by = "Phylum",
edge.colour.by = "weight",
edge.width.by = "weight",
show.label = c("Sulfolobales","Spirochaetales",
"Verrucomicrobiales"))
# labels can also be included via selecting specific rownames of x/y
plotRowGraph(order,
name = "row_graph",
colour.by = "Phylum",
edge.colour.by = "weight",
edge.width.by = "weight",
show.label = c(1,10,50))
# labels can also be included via a logical vector, which has the same length
# as nodes are present
label_select <- rep(FALSE,nrow(order))
label_select[c(1,10,50)] <- TRUE
plotRowGraph(order,
name = "row_graph",
colour.by = "Phylum",
edge.colour.by = "weight",
edge.width.by = "weight",
show.label = label_select)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.