Skip to contents

Correlation X-Y scatterplot

Usage

plotCorrelation(object, ...)

# S4 method for DFrame
plotCorrelation(
  object,
  xCol,
  yCol,
  pointLabelCol = NULL,
  labels = list(title = NULL, subtitle = NULL, x = NULL, y = NULL),
  trans = c("identity", "log10", "log2"),
  r2 = TRUE,
  se = TRUE,
  colors = list(dots = "black", line = "black", se = "gray")
)

# S4 method for Matrix
plotCorrelation(object, xCol, yCol, labelPoints = FALSE, ...)

# S4 method for SummarizedExperiment
plotCorrelation(object, assay = 1L, ...)

# S4 method for data.frame
plotCorrelation(
  object,
  xCol,
  yCol,
  pointLabelCol = NULL,
  labels = list(title = NULL, subtitle = NULL, x = NULL, y = NULL),
  trans = c("identity", "log10", "log2"),
  r2 = TRUE,
  se = TRUE,
  colors = list(dots = "black", line = "black", se = "gray")
)

# S4 method for matrix
plotCorrelation(object, xCol, yCol, labelPoints = FALSE, ...)

Arguments

object

Object.

xCol, yCol

character(1) or integer(1). X and Y column name or position.

pointLabelCol

character(1) or NULL. For data.frame method, which column name or position should be used to label points on the plot?

labels

list. ggplot2 labels. See ggplot2::labs() for details.

trans

character(1). Name of the axis scale transformation to apply.

For more information:

help(topic = "scale_x_continuous", package = "ggplot2")

r2

logical(1). Show information on the lm fit? This includes the equation, and the coefficient of determination (R^2). Refer to ggpmisc::stat_poly_eq for details.

se

logical(1). Display confidence interval around the lm fit line? Refer to ggplot2::geom_smooth for details.

colors

list(3). Named list defining the colors of dots, line, and se, for confidence interval standard error.

labelPoints

logical(1). For matrix method, label points on plot with row names?

...

Additional arguments.

assay

vector(1). Assay name or index position.

Value

Plot.

Note

Updated 2023-12-10.

Correlation coefficient calculations

Correlation coefficient calcluations are generated by ggpmisc::stat_poly_eq. Refer to the ggpmisc GitHub repo for details.

Examples

data(RangedSummarizedExperiment, package = "AcidTest")

## SummarizedExperiment ====
object <- RangedSummarizedExperiment
plotCorrelation(
    object = object,
    xCol = 1L,
    yCol = 2L,
    trans = "identity"
)