Get centers of clusters given a Seurat object, to use for labelling in tSNE space. The cluster center is defined as the median X and Y coordinate across cells in each cluster.

clusterCenters(seurat, reduction, dim1, dim2)

Arguments

seurat

Seurat object, where dimensionality reduction has been applied, i.e. (after applying Seurat::RunTSNE() to the object).

Value

Data frame with three columns: Cluster, mean_tSNE_1, and mean_tSNE_2

Examples

clusterCenters(pbmc, reduction = "pca", dim1 = 1, dim2 = 3)
#> # A tibble: 4 x 3 #> Cluster mean_x mean_y #> <fct> <dbl> <dbl> #> 1 0 -1.18 -0.629 #> 2 1 -0.439 0.472 #> 3 2 -1.22 0.188 #> 4 3 5.89 -0.199