plot_mds: Plot MDS

View source: R/plot_mds.R

plot_mdsR Documentation

Plot MDS

Description

Plot multi-dimensional scaling plot using algorithm of limma::plotMDS(). It is recommended this be done with the log-methylation-ratio matrix generated by bsseq_to_log_methy_ratio().

Usage

plot_mds(
  x,
  top = 500,
  plot_dims = c(1, 2),
  labels = colnames(x),
  groups = NULL,
  legend_name = "group"
)

Arguments

x

the log-methylation-ratio matrix.

top

the number of top genes used to calculate pairwise distances.

plot_dims

the numeric vector of the two dimensions to be plotted.

labels

the character vector of labels for data points. By default uses column names of x, set to NULL to plot points.

groups

the character vector of groups the data points will be coloured by. Colour palette can be adjusted using scale_colour_*() functions from ggplot2. If groups is numeric, the points will be coloured by a continuous colour palette. By default, groups is NULL and the points will not be coloured.

legend_name

the name for the legend.

Value

ggplot object of the MDS plot.

Examples

nmr <- load_example_nanomethresult()
bss <- methy_to_bsseq(nmr)
lmr <- bsseq_to_log_methy_ratio(bss)
plot_mds(lmr)


Shians/NanoMethViz documentation built on June 3, 2024, 3:23 a.m.