export picture from R studio
1
0
Entering edit mode
3.0 years ago

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)
design <- make.design.matrix(edesign.channel)

#Finding signiﬁcant 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 • 563 views ADD COMMENT 1 Entering edit mode 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()

3
Entering edit mode
3.0 years ago
nterhoeven ▴ 120

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