addPlots {OmicNavigator} | R Documentation |
Add custom plotting functions
Description
Include custom plots that the app will display when a feature is selected by the user.
Usage
addPlots(study, plots, reset = FALSE)
Arguments
study |
An OmicNavigator study created with |
plots |
Custom plotting functions for the study. The input object is a
nested list. The first list corresponds to the modelID(s). The second list
corresponds to the name(s) of the function(s) defined in the current R
session. The third list provides metadata to describe each plot. The only
required metadata element is |
reset |
Reset the data prior to adding the new data (default:
|
Details
Custom plotting functions are passed a list of data frames: assays
with the measurements, features
with the feature data,
samples
with the sample data, and results
with test results
data. Note that assays
, features
and results
only include data for the specified featureID(s) (and
re-ordered so their rows match). Thus your custom plotting function must have
at least one argument. It can have additional arguments if you wish, but
these must be provided with default values, because plotStudy
only
passes the plotting data to the first argument.
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.
Value
Returns the original onStudy
object passed to the argument
study
, but modified to include the newly added data