Description Usage Arguments Value Author(s) See Also Examples
View source: R/aveytoolkit_ggSmoothExprPlot.R
Wrapper around ggplot to transform data and plot profiles (e.g. expression or activity) over time
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ggSmoothExprPlot(
x,
mat,
rows,
method = "auto",
formula = formula("y ~ x"),
splitRowBy = NA,
splitColBy = NA,
colorBy = NULL,
cols = NA,
whichCols = NA,
sep = ".",
colorByLabel = "Response",
ggtitle = TRUE,
xlab = "Time (Days Post-Vaccination)",
ylab = "Expression",
colors = c("#1B9E77", "#D95F02", "#7570B3", "#E7298A", "#66A61E", "#E6AB02",
"#A6761D", "#666666"),
space = "fixed",
scales = "fixed",
fileName = NA,
plot = TRUE
)
|
x |
the numeric x-axis variable for the plot (usually time) |
mat |
data.frame or matrix of values to plot with samples in columns |
rows |
row names or row indices of the items to be plotted |
method |
smoothing method (function). See |
formula |
a formula to use for smoothing in |
splitRowBy |
a factor used to split the data by row in facet_grid |
splitColBy |
a factor used to split the data by col in facet_grid |
colorBy |
a factor used for coloring. No coloring will be done if |
cols |
substring to search for with "grep" in column names to be plotted |
whichCols |
the column indices or full column names |
sep |
a separator used in searching for cols in the column names |
colorByLabel |
the labels used for the color legend |
ggtitle |
logical. If TRUE, |
xlab |
passed to |
ylab |
passed to |
colors |
The colors to use. Defaults to the colors given by using RColorBrewer's "Dark2" pallette (but RColorBrewer is not called directly so is not required). |
space |
If |
scales |
Are scales shared across all facets (the default, |
fileName |
the name of a file to write a PDF to or |
plot |
logical specifying whether or not to plot the plot(s). Default is TRUE. |
invisibly returns a list with 2 elements: ggplot: the ggplot object to be plotted (this can be added to dat: a named list of the data frame(s) passed to data in ggplot. The names come from converting the rows argument to a character vector.
Stefan Avey
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | data(OrchardSprays)
## Example of functionality
library(Biobase)
data(sample.ExpressionSet, package="Biobase")
dat <- sample.ExpressionSet
## Normally x-axis is time but in this dataset there is no time
## so we will use the `score` as the x-axis
genderF <- dat$sex == "Female"
ggSmoothExprPlot(x=dat$score[genderF],
mat=exprs(dat),
rows="31345_at",
whichCols=which(genderF), # females only
colorBy=as.factor(dat$type)[genderF],
colorByLabel="Condition",
xlab="score")
## Not run: tmp <- ggSmoothExprPlot(x=times[subset], mat=expr, rows=gene,
formula=formula("y ~ ns(x,3)"),
whichCols=subset, colorBy=target[subset,respType],
splitColBy=splitby,
splitRowBy=as.factor(target[subset,"Study"]),
ggtitle=TRUE, colorByLabel=respType, plot=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.