HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
67 stars 31 forks source link

Changing data point label size on MDS plot #314

Closed Tregwiz closed 1 year ago

Tregwiz commented 1 year ago

Hi, Are you aware of a way to change the size of the data point labels on the MDS plot? The default label size is too big and results in the labels not being displayed due to excess overlap. I have been able to change the font size of all of the other components on the MDS plots using the default arguments for ggplot e.g. p + font("xy.text", size = 12), however this method doesn't allow for a data point label argument. Thanks.

HelenaLC commented 1 year ago

A little hacky, but setting the size at .$layers[[2]]$aes_params should do the tricky:

library(CATALYST)
data(PBMC_fs, PBMC_panel, PBMC_md)
sce <- prepData(PBMC_fs, PBMC_panel, PBMC_md)
plt <- pbMDS(sce, by = "sample_id", features = "state")
plt$layers[[2]]$aes_params <- list(size = 1)

image image In principle, any ggplot can be post-modified in this way, that is, by finding and setting/overwriting the corresponding aes_params and/or geom_params of a given layer (comes in useful when packages create plots a certain way but do not/cannot expose arguments to control all possible aesthetics for all possible layers ;)

Tregwiz commented 1 year ago

Hi Helena, Thanks ever so much - that is super helpful.