[How to Save plots in R] DiffBind
Hi,
I'm trying to use a R package for the first time.
Does anyone know how to save/ export a plot (e.g. heatmap) in DiffBind?
Example: in there example (https://bioconductor.org/packages/release/bioc/vignettes/DiffBind/inst/doc/DiffBind.pdf) Heatmap was generated by
plot(tamoxifen)
or
dba.plotHeatmap(tamoxifen)
What should I add in order to save the plot directly from the command? Thanks!!
• 5,060 views
•
link
1 answer
The comment above is the correct answer to the question. Before plotting, call one of the functions that redirects the plot to a file, such as jpeg(), pdf(), or png(). After plotting, call dev.off() to close the file. You can do multiple plots before calling dev.off() and they will all end up in the same file.
• 0 views
•
link
Log in to answer this question.
This doesn't look like a bioinformatics question to me and might get closed for that reason. Meanwhile, try this:
Additionally, using RStudio will let you see your plots, adjust any plotting settings, and then save them as an image quite easily. Useful if you think you're going to have to mess with your figures repeatedly or if you want to view dataframes, etc directly in a table format.
Won't work on a headless server though, obviously.