plotIndiv annotate sample by two or more grouping

Create issue
Issue #123 resolved
Former user created an issue

I wonder to class my data based on A+B. but when plotting the figure, I want to legend A and B separately. Like, A by color, B by pch. Is that possible? Thanks.

Comments (2)

  1. Florian Rohart

    Hi there,

    I'm not sure what you want to do, but you can have two legends using plotIndiv, one for the color and one for the pch:

    library(mixOmics)
    data(breast.tumors)
    X <- breast.tumors$gene.exp
    Y <- breast.tumors$sample$treatment
    splsda.breast <- splsda(X, Y,keepX=c(10,10),ncomp=2)
    plotIndiv(splsda.breast, ind.names = FALSE, pch = c(3,4,2), legend=T)
    

    or

    data(liver.toxicity)
    X <- liver.toxicity$gene
    Y <- liver.toxicity$clinic
    toxicity.spls <- spls(X, Y, ncomp = 3, keepX = c(50, 50, 50),
    keepY = c(10, 10, 10))
    
    plotIndiv(toxicity.spls, rep.space= 'X-variate',
    group = liver.toxicity$treatment[, 'Time.Group'],
    ind.names = FALSE,
    legend = TRUE,pch=c(1,2,3))
    
  2. Log in to comment