| addPlots | R Documentation |
addPlots() adds custom plotting functions and plot metadata to an
OmicNavigator study.
addPlots(study, plots, reset = FALSE)
study |
An OmicNavigator study created with |
plots |
A nested list containing custom plotting functions and plot
metadata. The input object is a 3-level nested list. The first, or
top-level list element name(s) must match the study |
reset |
Reset the data prior to adding the new data (default:
|
Custom plotting functions must be constructed to accept as the first argument
the value returned from getPlottingData(). Custom plotting functions can
have additional arguments, but these must be provided with default values.
The end-user should call getPlottingData() when testing their custom
plotting function. The end-user should consider the nature of the plot, i.e.
the plotType and (rarely) models values (see getPlottingData()). For
example, a custom plotting function meant to produce a multiTest plot
should accept the output of a getPlottingData() call with multiple
testIDs assigned to the testID argument. See the details section of
plotStudy() for a description of how plotType dictates the way a custom
plotting function is invoked by the app.
Note that any ggplot2 plots will require extra care. This is because the
plotting code will be inserted into a study package, and thus must follow the
best
practices for using ggplot2 within packages. Specifically, when you refer to
columns of the data frame, e.g. aes(x = group), you need to prefix it
with .data$, so that it becomes aes(x = .data$group).
Fortunately this latter code will also run fine as you interactively develop
the function.
Note that the plotting functions are written to the R package when the study
is exported via exportStudy or installed via
installStudy, not when addPlots is invoked. In other
words, if you add a custom plotting function to your study object via
addPlots, but then subsequently update the function in the global
environment prior to installing the study, this latest version will be saved
in the R package and executed when run in the app.
Returns the original onStudy object passed to the argument
study, but modified to include the newly added data
getPlottingData, plotStudy
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.