Skip to contents

Computes t-SNE into two dimensions and plots the map as hexagonal bins, where the value of the coloring variable is summarised for each bin, by default as the mean of the values inside the bin. In case there are missing values, PCA is performed using the nipals method of pca, the method can be changed to "ppca" if nipals fails.

Usage

plot_tsne_hexbin(
  object,
  all_features = FALSE,
  center = TRUE,
  scale = "uv",
  pca_method = "nipals",
  perplexity = 30,
  fill = "Injection_order",
  summary_fun = "mean",
  bins = 10,
  title = "t-SNE",
  subtitle = paste("Perplexity:", perplexity),
  fill_scale = getOption("notame.fill_scale_con"),
  assay.type = NULL,
  ...
)

Arguments

object

a SummarizedExperiment or MetaboSet object

all_features

logical, should all features be used? If FALSE (the default), flagged features are removed before visualization.

center

logical, should the data be centered prior to PCA? (usually yes)

scale

scaling used, as in prep. Default is "uv" for unit variance

pca_method

the method used in PCA if there are missing values

perplexity

the perplexity used in t-SNE

fill

character, name of the column used for coloring the hexagons

summary_fun

the function used to compute the value for each hexagon

bins

the number of bins in x and y axes

title, subtitle

the titles of the plot

fill_scale

the fill scale as returned by a ggplot function

assay.type

character, assay to be used in case of multiple assays

...

additional arguments passed to Rtsne

Value

A ggplot object.

See also

Examples

data(example_set)
plot_tsne_hexbin(example_set, perplexity = 10)
#> Warning: Computation failed in `stat_summary_hex()`.
#> Caused by error in `compute_group()`:
#> ! The package "hexbin" is required for `stat_summary_hex()`.