plotFeatureClasses | R Documentation |
Allows the visualisation of measurements in the data set. If useFeatures
is of type Pairs
, then a parallel plot is automatically drawn.
If it's a single categorical variable, then a bar chart is automatically
drawn.
## S4 method for signature 'matrix'
plotFeatureClasses(measurements, ...)
## S4 method for signature 'DataFrame'
plotFeatureClasses(
measurements,
classes,
useFeatures,
groupBy = NULL,
groupingName = NULL,
whichNumericFeaturePlots = c("both", "density", "stripchart"),
measurementLimits = NULL,
lineWidth = 1,
dotBinWidth = 1,
xAxisLabel = NULL,
yAxisLabels = c("Density", "Classes"),
showXtickLabels = TRUE,
showYtickLabels = TRUE,
xLabelPositions = "auto",
yLabelPositions = "auto",
fontSizes = c(24, 16, 12, 12, 12),
colours = c("#3F48CC", "#880015"),
showAssayName = TRUE
)
## S4 method for signature 'MultiAssayExperiment'
plotFeatureClasses(
measurements,
useFeatures,
classesColumn,
groupBy = NULL,
groupingName = NULL,
showAssayName = TRUE,
...
)
measurements |
A |
... |
Unused variables by the three top-level methods passed to the internal method which generates the plot(s). |
classes |
Either a vector of class labels of class |
useFeatures |
If |
groupBy |
If |
groupingName |
A label for the grouping variable to be used in plots. |
whichNumericFeaturePlots |
If the feature is a single feature and has
numeric measurements, this option specifies which types of plot(s) to draw.
The default value is |
measurementLimits |
The minimum and maximum expression values to plot.
Default: |
lineWidth |
Numeric value that alters the line thickness for density plots. Default: 1. |
dotBinWidth |
Numeric value that alters the diameter of dots in the strip chart. Default: 1. |
xAxisLabel |
The axis label for the plot's horizontal axis. Default:
|
yAxisLabels |
A character vector of length 1 or 2. If the feature's
measurements are numeric an |
showXtickLabels |
Logical. Default: |
showYtickLabels |
Logical. Default: |
xLabelPositions |
Either |
yLabelPositions |
Either |
fontSizes |
A vector of length 5. The first number is the size of the title. The second number is the size of the axes titles. The third number is the size of the axes values. The fourth number is the size of the legends' titles. The fifth number is the font size of the legend labels. |
colours |
The colours to plot data of each class in. The length of this vector must be as long as the distinct number of classes in the data set. |
showAssayName |
Logical. Default: |
classesColumn |
If |
Plots are created on the current graphics device and a list of plot
objects is invisibly returned. The classes of the plot object are determined
based on the type of data plotted and the number of plots per feature
generated. If the plotted variable is discrete or if the variable is numeric
and one plot type was specified, the list element is an object of class
ggplot
. Otherwise, if the variable is numeric and both the density
and stripchart plot types were made, the list element is an object of class
TableGrob
.
Settling lineWidth
and dotBinWidth
to the same value doesn't
result in the density plot and the strip chart having elements of the same
size. Some manual experimentation is required to get similarly sized plot
elements.
Dario Strbenac
# First 25 samples and first 5 genes are mixtures of two normals. Last 25 samples are
# one normal.
genesMatrix <- sapply(1:15, function(geneColumn) c(rnorm(5, 5, 1)))
genesMatrix <- cbind(genesMatrix, sapply(1:10, function(geneColumn) c(rnorm(5, 15, 1))))
genesMatrix <- cbind(genesMatrix, sapply(1:25, function(geneColumn) c(rnorm(5, 9, 2))))
genesMatrix <- rbind(genesMatrix, sapply(1:50, function(geneColumn) rnorm(95, 9, 3)))
genesMatrix <- t(genesMatrix)
rownames(genesMatrix) <- paste("Sample", 1:50)
colnames(genesMatrix) <- paste("Gene", 1:100)
classes <- factor(rep(c("Poor", "Good"), each = 25), levels = c("Good", "Poor"))
plotFeatureClasses(genesMatrix, classes, useFeatures = "Gene 4",
xAxisLabel = bquote(log[2]*'(expression)'), dotBinWidth = 0.5)
infectionResults <- c(rep(c("No", "Yes"), c(20, 5)), rep(c("No", "Yes"), c(5, 20)))
genders <- factor(rep(c("Male", "Female"), each = 10, length.out = 50))
clinicalData <- DataFrame(Gender = genders, Sugar = runif(50, 4, 10),
Infection = factor(infectionResults, levels = c("No", "Yes")),
row.names = rownames(genesMatrix))
plotFeatureClasses(clinicalData, classes, useFeatures = "Infection")
plotFeatureClasses(clinicalData, classes, useFeatures = "Infection", groupBy = "Gender")
genesMatrix <- t(genesMatrix) # MultiAssayExperiment needs features in rows.
dataContainer <- MultiAssayExperiment(list(RNA = genesMatrix),
colData = cbind(clinicalData, class = classes))
targetFeatures <- DataFrame(assay = "RNA", feature = "Gene 50")
plotFeatureClasses(dataContainer, useFeatures = targetFeatures, classesColumn = "class",
groupBy = c("clinical", "Gender"), # Table name, feature name.
xAxisLabel = bquote(log[2]*'(expression)'), dotBinWidth = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.