Plot 2D graph layouts
Plot2DGraph.Rd
Plot 2D component graph layouts computed with ComputeLayout
and
optionally color nodes by certain attributes. Edges can also be visualized
by setting map_edges
; however, since component graphs tend to be very
large, this can take a long time to draw.
Usage
Plot2DGraph(
object,
cells,
marker = NULL,
assay = NULL,
layout_method = c("pmds", "wpmds", "fr", "kk", "drl"),
colors = c("lightgrey", "mistyrose", "red", "darkred"),
map_nodes = TRUE,
map_edges = FALSE,
log_scale = TRUE,
node_size = 0.5,
edge_width = 0.3,
show_Bnodes = FALSE,
collect_scales = FALSE,
return_plot_list = FALSE,
...
)
Arguments
- object
A
Seurat
object- cells
A character vector with cell IDs
- marker
Name of a marker to colors nodes/edges by
- assay
Name of assay to pull data from
- layout_method
Select appropriate layout previously computed with
ComputeLayout
- colors
A character vector of colors to color marker counts by
- map_nodes, map_edges
Should nodes and/or edges be mapped?
- log_scale
Convert node counts to log-scale with
log1p
- node_size
Size of nodes
- edge_width
Set the width of the edges if
map_edges = TRUE
- show_Bnodes
Should B nodes be included in the visualization? This option is only applicable to bipartite graphs. Note that by removing the B nodes, all edges are removed from the graph and hence,
map_edges
will have no effect.- collect_scales
Collect color scales so that their limits are the same. This can be used to make sure that the colors are comparable across markers.
- return_plot_list
Instead of collecting the plots in a grid, return a list of
ggplot
objects.- ...
Not yet implemented
Examples
library(pixelatorR)
pxl_file <- system.file("extdata/five_cells",
"five_cells.pxl",
package = "pixelatorR"
)
seur <- ReadMPX_Seurat(pxl_file)
#> ✔ Created a 'Seurat' object with 5 cells and 80 targeted surface proteins
seur <- LoadCellGraphs(seur, load_as = "Anode")
#> → Loading CellGraphs for 5 cells from sample 1
#> ✔ Successfully loaded 5 CellGraph object(s).
seur <- ComputeLayout(seur, layout_method = "pmds", dim = 2)
#> ℹ Computing layouts for 5 graphs
Plot2DGraph(seur, cells = colnames(seur)[1], marker = "CD3E")