LieberInstitute / zandiHyde_bipolar_rnaseq

RNA-seq analysis for psychENCODE R01
6 stars 1 forks source link

Failure to generate multiple histogram plots #1

Closed aseyedia closed 4 years ago

aseyedia commented 4 years ago

This chunk does not produce the intended result:

https://github.com/LieberInstitute/zandiHyde_bipolar_rnaseq/blob/75e5a28f5f8c14814080dd98fa550ab7f08d3788/dev_twas/process-hg19-gwas.R#L114-L119

What I want is multiple plots represented in the same file, maybe in a png but obviously pdf is acceptable as well. Unfortunately, I am not skilled in plotting in R so I have to come back to this later. For now, the output looks like this:

PGC_BIP_hg38_hist

which has neither color nor includes the other plot I wanted as well.

lcolladotor commented 4 years ago

With png() you can only save one plot per file at a time, unlike with pdf(). For small histograms like this, I would save it as pdf(). In general we prefer pdf() because it saves vectorized graphics and they are easier to put together into a multi figure panel that is of high enough quality for papers. I typically use the following arguments:

pdf(file = "something.pdf", useDingbats = FALSE)

## print any number of figures

dev.off()

I do play around with width and height (it's in inches by default in pdf()). The default is 7 by 7 inches, so sometimes I use say width = 14 if I want to have 2 side-by-side plots.