Exporting PCA and sPCA plots as .pdf

Dear mixOmics team,

That’s a newbie’s question… I’ve created my PCA and sPCA plots and am now trying to export them as pdf. using the function pdf() … dev.off(), however, I keep getting the following error message:

“Error in dev.off() : cannot shut down device 1 (the null device)”

I’ve tried replacing dev.off() with while(!is.null(dev.list()) dev.off(), but it creates a pdf with no pages…

Here’s my code chunk:

pdf(width = 10, height = 10)
plotIndiv(x, ...)
while(!is.null(dev.list())  dev.off()

Thanks in advance…

hi @MychelMorais

try instead:

pdf(‘my plot.pdf’, width = 10, height = 10)
plotIndiv(x, …)

You need to specify the name of the pdf plot.