Hello, I would like to use plotArrow to visualize mRNA,microRNA and Proteins. I get an Arrows plot and can colour label the two groups of samples in Y, but otherwise the plot is not responsive to any of my attempts to e.g. change the shapes or colours of the features (“Blocks”, i.e. RNA, microRNA and Proteins), at the end of the arrows, or even visualize the components (the axis labels remain at “Dimension 1” and “Dimension 2”, without further numerical values at the axes). I have tried the nutrimouse example but also cannot change the output. I have installed the latest development version. Thank you so much for your great support.
Thanks for contacting us regarding your question about the new
The output is now a
ggplot object which can be fully customised to your own preferences. Please see below for an example. Also, note that the values of dimensions for a multi-block plot cannot be shown as the scales are not the same (the values are standardised to be on the same scale).
library(mixOmics) packageVersion('mixOmics') #>  '6.15.45' data(nutrimouse) Y = unmap(nutrimouse$diet) data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid, Y = Y) design1 = matrix(c(0,1,1,1,0,1,1,1,0), ncol = 3, nrow = 3, byrow = TRUE) nutrimouse.sgcca <- wrapper.sgcca(X = data, design = design1, penalty = c(0.3, 0.5, 1), ncomp = 3, scheme = "centroid") plotArrow(nutrimouse.sgcca, group = nutrimouse$genotype, ind.names = TRUE, legend.title = 'Genotype' )
## custom pch by block blocks <- names(nutrimouse.sgcca$variates) pch <- seq_along(blocks) names(pch) <- blocks pch #> gene lipid Y #> 1 2 3 #> gene lipid Y #> 1 2 3 p <- plotArrow(nutrimouse.sgcca, group = nutrimouse$genotype, ind.names = TRUE, pch = pch, legend.title = 'Genotype') p
### further customise the ggplot object # custom labels p + labs(x = 'Variate 1', y = 'Variate 2') + guides( shape = guide_legend(title = 'BLOCK') )
## custom shapes p + scale_shape_manual(values = c(centroid = 1, gene=2, lipid=3, Y=4)) #> Scale for 'shape' is already present. Adding another scale for 'shape', which #> will replace the existing scale.
Hope it helps,
I performed DIABLO for a transcriptome and lipidome data of 4 sample groups. Using the plotArrow() function, I got the result plot like this.
You said “the values of dimensions for a multi-block plot cannot be shown as the scales are not the same (the values are standardised to be on the same scale)” but can I display and change the scale of the x and Y axes?
Or Can I extract the standardised values?
Is there any way to calculate the distance between the centroid of two groups?
This is not something we deem essential for the visualisation purposes. However, you can use the logic in the following section of the function to get what you described:
Hope it helps,