Hi @hschrieke,
Thanks for using mixOmics.
If the feature names are too long, the plots can become too narrow. For example, if untrimmed, the following plot:
data(nutrimouse)
Y = nutrimouse$diet
gene = nutrimouse$gene
lipid = nutrimouse$lipid
## extend feature names
suff <- "-a-long-suffix-from-abolutely-nowhere-which-is-gonna-be-longer-than-margins"
colnames(gene) <- paste0(colnames(gene), suff)
colnames(lipid) <- paste0(colnames(lipid), suff)
data = list(gene = gene, lipid = lipid)
design = matrix(c(0,1,1,1,0,1,1,1,0), ncol = 3, nrow = 3, byrow = TRUE)
nutrimouse.sgccda = block.splsda(X = data,
Y = Y,
design = design,
keepX = list(gene = c(10,10), lipid = c(15,15)),
ncomp = 2,
scheme = "centroid")
plotLoadings(nutrimouse.sgccda, contrib = "min")
Even with one long feature name would run into margin errors or could look like the following (even if no errors occur):
That is why we decided to limit the length of feature names with a message that informs about the trimming. You can still access the full feature names by saving the output from plotLoadings
.
pl_res <- plotLoadings(nutrimouse.sgccda, contrib = "min")
head(pl_res)
I just added a feature to the development version (which you can install using instruction in https://github.com/mixOmicsTeam/mixOmics#development-version) that allows you to adjust the trim length using a hidden max.name.length
argument. See example below:
plotLoadings(nutrimouse.sgccda, contrib = "min",
max.name.length = 50) ## custom trim length
You may increase to any large number you wish that produces a reasonable plot without a margin error.
Please let me know if you run into any issues.
Best wishes,
Al