Error in plotting arrow, diablo and correlation circle plot

Hello,

I am very used to run this script and never got any problems. It’s look like it concerns most setting of graphs?

  • Error 2: in plot arrow

plotArrow(final.mbspls.model, ind.names = FALSE,

  •       group=groups[,2],
    
  •       pch = list(lipid = 1, microbe = 6, metabolite = 7), pch.size = 3)
    

Error in plotArrow(final.mbspls.model, ind.names = FALSE, group = groups[, :
‘pch’ must be either a single value, or a vector whose names are the block names and whose values are the plot characters

  • Error 2: in Diablo

plotDiablo(final.mbspls.model, ncomp = 1)
Error in .External.graphics(C_layout, num.rows, num.cols, mat, as.integer(num.figures), :
invalid graphics state

*Error 3: in correlation circle plot

##Correlation circle plot with different symbols and colors
plotVar(final.mbspls.model, var.names = FALSE,

  •     style = 'graphics', legend = TRUE,
    
  •     pch = c(16, 17, 15), cex = c(2,2,2), 
    
  •     col = c('darkorchid', 'brown1', 'lightgreen'))
    

Error in .External.graphics(C_strWidth, as.graphicsAnnot(s), pmatch(units, :
invalid graphics state

I have honestly no clue on what could going because for the arrow and diablo plot I always copy past without editing anything. Same for correlation circle plot: since I found the right settings, I never touched anything.

Do you see a problem?

Best regards

Geraldine

Hi Geraldine, thanks for using mixOmics!

In order for me to help you with your issue, could you please do the following two things?

  1. Let me know which version of mixOmics you are using, you can just send the output of sessionInfo() in your reply
  2. Run the below code which creates a simple DIABLO model and runs these three plotting functions with default settings, let me know if these work without errors
# set up simple model
library(mixOmics)
data('breast.TCGA')
data <- list(mrna =  breast.TCGA$data.train$mrna,
            mirna =  breast.TCGA$data.train$mirna, prot =  breast.TCGA$data.train$protein)
list.keepX <- list(mrna = rep(20, 3), mirna = rep(10,3), prot = rep(10,3))
diablo <- block.splsda(X = data, 
                         Y = breast.TCGA$data.train$subtype, 
                         ncomp = 3, 
                         keepX = list.keepX, 
                         design = 'full')

# test plotting functions with basic settings
plotArrow(diablo)
plotDiablo(diablo, ncomp = 1, legend = TRUE, col.per.group = NULL)
plotVar(diablo)

If the above code runs well, then the issue is likely to be related to the additional arguments you are adding to the plotting functions, like group, pch, cex, col, and how these arguments interact with your model.

For example, if you run ?plotArrow you can see the information describing how you should pass the pch argument - “A character string or a named vector of single characters or integers whose names match those of object$variates .” I see in the error message you put for your plotArrow function seems to be an issue with the pch input. You have set pch = list(lipid = 1, microbe = 6, metabolite = 7), could you try using a named vector instead? You can use the below code to do that. You should also check that your DIABLO model’s datatypes match the ones in this list (ie lipid, microbe, metabolite).

pch <- c(1, 6, 7)
names(pch) <- c("lipid", "microbe", "metabolite")

Let me know how you get on with these suggestions and we can take it from there!
Cheers,
Eva