violin.electrophoresis | R Documentation |
This function creates a violin plot from a electrophoresis
object using geom_violin
.
violin.electrophoresis(
electrophoresis,
x = "sample.name",
y = "length",
weight = "molarity",
...,
flip = F,
normalize = T,
include.ladder = FALSE,
include.markers = FALSE,
lower.marker.spread = 10,
ylim = c(NA, NA),
adjust = 0.05,
title = NULL,
xlab = NULL,
ylab = NULL
)
electrophoresis |
An |
x |
The name of the variable to use as the x-position of each violin as a character vector. Replicates with the same value of |
y |
The name of the variable to use as the y-axis of the violins, as a character vector. Usually one of |
weight |
The name of the variable to use for the width of a violin at any given point on the y-axis, as a character vector. Usually one of |
... |
Additional aesthetics passed to |
flip |
Flip the axes so the violins are horizontal. |
normalize |
Normalize the violins (or sets of violins) to the same area (within the y-limits), i.e. |
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 |
ylim |
Limits of y-axis. |
adjust |
Bandwidth adjustment for the kernel smoothing in |
title, xlab, ylab |
Plot title, x-axis label, and y-axis label. |
Violin plots are essentially smoothened histograms, a box plot for the computer age. Here the symmetric "violins" are arrrayed along a common axis of molecule length, or raw migration time or distance, and the weight (width) of each violin at a given position represents the relative density of molecules there, which may be molarity, concentration, or raw fluorescence; the weight metric is not specified on the plot itself so you may want to mention it in a figure caption. This is a compact plot for comparing normalized samples side-by-side. Traditionally violin plots are vertical, like box plots, and like the (simulated) gel images provided by Agilent software; however, an option is provided to flip the coordinates to horizontal if that seems more intuitive (q.v. sparkline.electrophoresis
).
The main functional difference between this and qplot.electrophoresis
is that the sample names (or some other annotation) are used directly as the x-variable for side-by-side plotting, rather than as a faceting variable. One consequence is that replicates with an identical x-value will have their violins plotted together in a set with a single x-axis label (by position_dodge
). However, the underlying geom_violin
also allocates its area or width normalizations to these sets, not to the individual violins within a set, so if the numbers of samples per replicate set are imbalanced then the individual violins will also have imbalanced widths, keeping the set widths constant instead.
A ggplot object containing several layers. You can draw it directly or customize it like any other ggplot object by adding more layers.
qplot.electrophoresis
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.