This is a test version of Biostars. For the public version, visit https://www.biostars.org.
export picture from R studio

Dear all,

I have a script, the results for this script contains two diagrams, I want to export those two diagrams. I know the easiest way is to use the export button on the R studio, but in this example, the diagram didn't show in that area so I can not use the export button, I need to use a command line for that, if you know how could I do it?

Here is my script:

data.channel <- read.table("chl_normalized_counts.txt", header= TRUE, row.names=1)
edesign.channel <- read.table("edesign.abiotic.txt", header= TRUE, row.names=1)
design <- make.design.matrix(edesign.channel)

#Finding significant genes
library(MASS)
channelp<- p.vector(data.channel, design, counts=TRUE)
channelt <- T.fit(channelp)
get<-get.siggenes(channelt, vars="all")
write.table(file="pangasius.summary.txt",get$summary,sep = "\t",quote = F)
get$summary

#plot
see.genes(get$sig.genes, k = 8)
r

you could try to take output in a file and see if its generating some plot

plot.pdf("plot")
see.genes(get$sig.genes, k = 8)
dev.off()

1 answer

You can export plots from R with this:

pdf("filename.pdf")
plot(myData1)
plot(myData2)
dev.off()

This will create a pdf with two pages showing the two plots. Alternatively, you can use png()or svg()instead of pdf(), if you want a different file format.

There are also lots of ways to configure the export with additional options (like page size/ratio) to the pdf() command. Take a look at ?pdf() for more info

Log in to answer this question.