Skip to contents

Visualize spatial CCC graph in various formats, w/ or w/o tissue image

Usage

plot_spatial_ccc_graph(
  ccc_graph,
  graph_layout = "auto",
  cells_of_interest = NULL,
  edges_expanded_to_group = TRUE,
  edge_color = "LRscore",
  node_color = "LRscore.sum.src",
  edge_color_range = NULL,
  node_color_range = NULL,
  edge_width = 0.5,
  edge_alpha = 1,
  node_size = 0.5,
  node_alpha = 1,
  clip = TRUE,
  tissue_img = NULL,
  image_alpha = NA,
  which_on_top = "edge",
  show_arrow = FALSE
)

Arguments

ccc_graph

spatial CCC graph for a LR pair

graph_layout

string for graph layout algorithm. Default is "auto"; see Details for more information

cells_of_interest

array of cell ids to highlight.

edges_expanded_to_group

if TRUE and cells_of_interest is given, the nodes and the edges are expanded to include all the nodes and edges that belong to the groups that cells_of_interest belong to.

edge_color, node_color

column name to be used for edge and node colors, respectively

edge_color_range, node_color_range

bound given in c(min, max) format. if specified, the ranges are set using these values, instead of the ones derived from data. Useful when multiple plots are combined later for comparison.

edge_width, node_size

specify edge width and node size. Currently, default values do not work well. Might need some manual adjustments.

edge_alpha, node_alpha

specify transparency of edges and nodes

clip

if TRUE (dafault), tissue_img will be cliped to show only active cell-cell communications

tissue_img

Raster image, like imgRaster(spe)

image_alpha

alpha value for tissue_img. If NA, keep the current value.

which_on_top

either "edge" or "node"

show_arrow

if TRUE, arrow is added to edge. Default is FALSE.

Value

ggplot object of spatial CCC graph

Details

  • CCC graph with tissue image. In this format, the spots are placed on their original locations, keeping spatial relations.

  • CCC graph without tissue image. In this format, the spots are placed using either on their original locations ("spatial") or user-specified graph layout algorithm. Default is ("kk" = igraph::layout_with_kk()) algorithm. See create_layout() for available algorithms.

Examples

if (FALSE) {
plot_spatial_ccc_graph(ccc_graph = ccc_graph_list[["App_Dcc"]],
                       tissue_img = imgRaster(spe),
                       node_color = "group_diameter",
                       node_size = 1,
                       edge_color = "group_diameter",
                       which_on_top = "edge")

plot_spatial_ccc_graph(ccc_graph = ccc_graph_list[["App_Dcc"]],
                       node_color = "group_diameter",
                       node_size = 1,
                       edge_color = "group_diameter",
                       which_on_top = "edge")

plot_spatial_ccc_graph(ccc_graph = ccc_graph_list[["App_Dcc"]],
                       graph_layout = "stress",
                       node_color = "group_diameter",
                       node_size = 1,
                       edge_color = "group_diameter",
                       which_on_top = "edge")
}