qplot.electrophoresis | R Documentation |
This function is a shortcut to plot the data from an electrophoresis
object, wrapping ggplot
similarly to qplot
. The result is analogous to electropherograms produced by the Agilent software.
qplot.electrophoresis(
electrophoresis,
x = "length",
y = "molarity",
...,
log = "",
normalize = c("none", "total", "window"),
facets = ~sample.index,
margins = FALSE,
scales = "fixed",
geom = c("line", "area"),
include.ladder = FALSE,
include.markers = FALSE,
lower.marker.spread = 10,
xlim = c(NA, NA),
ylim = c(NA, NA),
show.peaks = c("all", "markers", "none"),
region.alpha = 0.2,
area.alpha = 0.2,
title = NULL,
xlab = NULL,
ylab = NULL
)
electrophoresis |
An |
x |
The name of the variable to use as the x-value of each point in the graph as a character vector. Usually one of |
y |
The name of the variable to use as the y-value of each point in the graph, as a character vector. Usually one of |
... |
Additional aesthetics passed to the geom for the main data (not the peaks or regions). Unlike the previous variables that are specified by character vectors, these use the normal aesthetic syntax, e.g. |
log |
Which variables to log-transform ( |
normalize |
Normalize the y-values in each sample with |
facets |
Faceting formula to use. Picks |
margins |
Display marginal facets (via |
scales |
Scaling rules for the facets, passed to |
geom |
Name of the geom to draw. Only |
include.ladder |
If |
include.markers |
If |
lower.marker.spread |
If normalizing the totals or excluding marker peaks, extend the lower marker peak by this amount (via |
xlim, ylim |
Limits of x- and y-axes |
show.peaks |
Whether to fill the areas under reported peaks. |
region.alpha |
Alpha-transparency of the highlight in the reported regions of interested. Set to |
area.alpha |
Alpha-transparency of the filled areas under the curves, if |
title, xlab, ylab |
Plot title, x-axis label, and y-axis label. |
A ggplot object containing several layers. You can draw it directly or customize it like any other ggplot object by adding more layers.
Before plotting, unless the y-variable is fluorescence, it is scaled by the differentials in the x-value. Thus the units of the y-axis are divided by the units of the x-axis, e.g. molarity per length. This ensures that the area under the curve (width times height) represents the desired variable in the correct units. For example, if the x-variable is length in bp, the graph will be equivalent to a histogram with one bar for each possible molecule length in base pairs.
The x- and y-variable names must be provided as character
objects, e.g. "length"
rather than length
. However, additional aesthetics in ...
are passed directly to aes
so they must be provided as the variable names themselves, e.g. color = sample.observations
rather than color = "sample.observations"
.
Both of the supported geoms for the main data, geom_line
and geom_area
, are given the specified x-variable as x
and the appropriately transformed y-variable as y
, as well as group = sample.index
to ensure overlaid samples are plotted distinctly. If facets
is null, then the geom is also given either color = sample.name
(if geom == "line"
) or fill = sample.name
(if geom == "area"
) to color-code overlaid samples. Thus if replicates of the same sample have the same name, they will also have the same color.
If peak.fill
is not NA and facets
is not null and electrophoresis$peaks
is not null, then the plot gets an extra geom_area
from only the subset of electrophoresis$data
that is within the reported peaks, using the same settings as above except fill = peak.fill
. If you use a faceting formula other than NULL
that allows some samples to be overlaid in the same facet, it may be a good idea to set peak.fill = NA
so their peaks don't overlap.
If region.alpha
is not NA and facets
is not null and electrophoresis$regions
is not null, then the plot gets a geom_rect
with ymin = -Inf, ymax = Inf
and xmin
and xmax
set to the lower and upper boundaries of the regions, while alpha = region.alpha
.
rawplot.electrophoresis
, sparkline.electrophoresis
, violin.electrophoresis
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.