Skip to contents

Draws one panel per cell type (and per comparison group when compare.by was used in CorrelateGene()) assembled with patchwork::wrap_plots(). Each panel shows the top n_pos most positively and top n_neg most negatively correlated genes so that both directions are always represented.

Usage

PlotCorrelation(
  cor_result,
  cell.type = NULL,
  n_pos = 15L,
  n_neg = 15L,
  label_n = 5L,
  padj_cutoff = 0.05,
  r_cutoff = NULL,
  ncol = NULL,
  output_dir = NULL,
  file_name = NULL,
  width = NULL,
  height = NULL,
  timestamp = FALSE
)

Arguments

cor_result

Data frame returned by CorrelateGene().

n_pos

Integer. Top positive genes to show per panel. Default 15.

n_neg

Integer. Top negative genes to show per panel. Default 15.

label_n

Integer. Significant genes to label per direction per panel. Default 5 (5 positive + 5 negative).

padj_cutoff

Numeric. Significance threshold. Default 0.05.

r_cutoff

Numeric or NULL. Optional ±r dotted reference lines.

ncol

Integer or NULL. Columns in the assembled figure. NULL auto-selects: n_compare_groups when compare.by was used, else 3.

output_dir

Character or NULL. Directory to save a PDF.

file_name

Character or NULL. PDF base name.

width

Numeric or NULL. Override the auto-calculated PDF width in inches. NULL (default) sizes automatically from n_col_out.

height

Numeric or NULL. Override the auto-calculated PDF height in inches. NULL (default) sizes automatically from the number of panel rows.

timestamp

Logical. When TRUE, append a _YYYYMMDD-HHMMSS stamp to the saved file name so repeated runs are versioned instead of overwriting the previous PDF. Default FALSE.

cell_type

Character vector or NULL. Cell types to plot (all by default).

Value

A patchwork object (invisibly when saved).

See also