plot_gr: Plots a cell hierarchy.

View source: R/04_flowgraph_plots.R

plot_grR Documentation

Plots a cell hierarchy.

Description

Plots a cell hierarchy given the output from fg_plot, a list of nodes and edges.

Usage

plot_gr(
  gr,
  main = NULL,
  show_bgedges = TRUE,
  colour_palette = NULL,
  label_coloured = TRUE,
  shiny_plot = FALSE,
  interactive = FALSE,
  visNet_plot = TRUE,
  colour_edges = FALSE,
  ...
)

Arguments

gr

A list containing data frames e and v.

main

A string containing the plot title. If this is set to NULL, the function will look for a plot title in the main slot of gr; otherwise, this defaults to "".

show_bgedges

A logical variable indicating whether or not edges not specified for plotting should be plotted as light grey in the background. If this is NULL, the function will look for a show_bgedges in the show_bgedges slot of gr; otherwise, this defaults to TRUE.

colour_palette

A colour palette e.g. the default palette if the user sets this to NULL is c('blue','cyan','yellow','red').

label_coloured

A logical indicating whether to colour the node labels using the same colours as the nodes in the non-interactive plot.

shiny_plot

A logical indicating whether this plot is made for shiny; users don't need to change this.

interactive

A logical variable indicating whether the plot should be an interactive plot; see package ggiraph.

visNet_plot

A logical variable indicating if an interactive plot is chosen, if function should output a visNetwork plot; if set to FALSE, ggplot's girafe will be used instead.

colour_edges

A logical variable indicating whether to colour edges if plotting a node feature summary.

...

Other parameters for ggplot if interactive is set to FALSE; other parameters for plot_ly if interactive is set to TRUE.

Value

A ggplot object if interactive is set to FALSE; a ggiraph object if interactive is set to TRUE.

See Also

flowGraph-class fg_plot get_phen_meta ggdf fg_get_feature fg_get_summary

Examples


 no_cores <- 1
 data(fg_data_pos2)
 fg <- flowGraph(fg_data_pos2$count, class=fg_data_pos2$meta$class,
                 no_cores=no_cores)

 # fg <- fg_summary(fg, no_cores=no_cores, class="class", control="control",
 #                  overwrite=FALSE, test_name="t_byLayer", diminish=FALSE)

 gr_summary <- fg_plot(
   fg, type="node", p_thres=.05, show_bgedges=TRUE,
   path=NULL) # set path to a full path to save plot as a PNG

 plot_gr(gr_summary, main=gr_summary$main, show_bgedges=TRUE)

 plot_gr(gr_summary, main=gr_summary$main, show_bgedges=TRUE, interactive=TRUE)


aya49/flowGraph documentation built on Feb. 4, 2024, 6:40 p.m.