bartongroup / RATS

Relative Abundance of Transcripts: An R package for the detection of Differential Transcript isoform Usage.
MIT License
32 stars 1 forks source link

Saving gene plots... #9

Closed nickschurch closed 7 years ago

nickschurch commented 7 years ago

It would be nice to add some keyword arguments to plot_gene to allow the plot to be saved directly to a file as well as displayed. That would allow lists of genes with sDTU to be looped over quickly and output all their plots, rather than the laborious click-and-save required at the moment.

fruce-ki commented 7 years ago

It is not typical practice for plotting functions in R to output directly to files. The desired result can be easily achieved using standard R output redirection as follows:

pdf("path/my_gene_plot.pdf") print( plot_gene(my_dtu, my_gene_id) ) dev.off()

A looping structure added inside or around these 3 lines can easily pile a boat-load of plots into one or multiple files, as desired.

Or to both display and save:

myplot <- plot_gene(my_dtu, my_gene_id) print(myplot) pdf("path/my_gene_plot.pdf") print(myplot) dev.off()