Plot exposures in multiple plots to a single PDF file, with each plot showing exposures for a manageable number of samples.
plot_exposure_to_pdf(
exposure,
file,
mfrow = c(2, 1),
mar = c(6, 4, 3, 2),
oma = c(3, 2, 0, 2),
samples.per.line = 30,
plot.proportion = FALSE,
xlim = NULL,
ylim = NULL,
legend.x = NULL,
legend.y = NULL,
cex.legend = 0.9,
cex.yaxis = 1,
cex.xaxis = NULL,
plot.sample.names = TRUE,
yaxis.labels = NULL,
width = 8.2677,
height = 11.6929,
...
)An invisible list. The first element is a logical value indicating whether the plot is successful. The second element is a numeric vector giving the coordinates of the bar x-axis midpoints drawn, useful for adding to the graph.
Exposures as a numerical matrix (or data.frame)
with signatures in rows and samples in columns. Rownames are taken as the
signature names and column names are taken as the sample IDs. If you want
exposure sorted from largest to smallest, use
sort_exposure. Do not use column names that start with
multiple underscores. The exposures will often be mutation counts, but
could also be e.g. mutations per megabase.
The name of the PDF file to be produced.
A vector of the form c(nr, nc).
Subsequent figures will be drawn in an nr-by-nc
array on the device by rows.
A numerical vector of the form c(bottom,
left, top, right) which gives the number of lines of margin to be
specified on the four sides of the plot.
A vector of the form c(bottom, left, top,
right) giving the size of the outer margins in lines of text.
Number of samples to show in each plot.
Plot exposure proportions rather than counts.
Limits for the x and y axis. If NULL(default), the
function tries to do something reasonable.
The x and y co-ordinates to be used to position the legend.
A numerical value giving the amount by which legend plotting text and symbols should be magnified relative to the default.
A numerical value giving the amount by which y axis values should be magnified relative to the default.
A numerical value giving the amount by which x axis values
should be magnified relative to the default. If
NULL(default), the function tries to do something reasonable.
Whether to plot sample names below the x axis.
Default is TRUE. Ignored if there are no column names on
exposure.
User defined y axis labels to be plotted. If
NULL(default), the function tries to do something reasonable.
The width and height of the graphics region in inches.
Other arguments passed to barplot. If
ylab is not included, it defaults to a value depending on
plot.proportion. If col is not supplied the function tries to
do something reasonable.
file <- system.file("extdata",
"Liver-HCC.exposure.csv",
package = "mSigTools"
)
exposure <- read_exposure(file)
plot_exposure_to_pdf(exposure,
file = file.path(tempdir(), "Liver-HCC.exposure.pdf"),
cex.yaxis = 0.8, plot.proportion = TRUE
)
Run the code above in your browser using DataLab