prep_tornado: Prepare tornado array for plotting

Description Usage Arguments Details Value Examples

View source: R/prepare_tornado.R

Description

Converts the data from a TornadoExperiment to a data.frame that is accepted in ggplot2 plots.

Usage

1
2
3
4
5
6
7
8
9
prep_tornado(
  tornado,
  assay_name = assayNames(tornado),
  upper = "q0.99",
  lower = 0,
  scale_title = "Coverage",
  scale = NULL,
  ...
)

Arguments

tornado

A TornadoExperiment object.

assay_name

A character(1): one of the assay names retrieved by assayNames(tornado).

upper, lower

Limits to the colour scale. Can be one of the following:

  • A numeric to set absolute limits directly.

  • A character in the form of a number prefixed by "p" or "q" to set the percentile or quantile respectively. For example, "p99" and "q0.95" set the limit to the 99th percentile or 0.95th quantile respectively. The limits as specified in the lower and upper arguments can be overridden if the scale argument has non-default limits.

scale_title

A character(1) with the title for the colourbar. Can be overridden when the scale argument has a non-default name.

scale

A continuous fill scale from the ggplot2 package to use to colour the tornado. When NULL (default), the scale will be retrieved from the option "tornadoplot.default.scale".

...

Not currently used.

Details

The typical way of plotting a raster in ggplot2 is with the geom_raster() function. However, this requires you to melt the raster first only to later reconstitute it, which can be rather inefficient. To circumvent this inconvenience, we pre-colour the data here with a ggplot2 scale.

Value

A tornado_df, data.frame class object with a modified scale in the "scale" attribute.

Examples

1

teunbrand/tornadoplot documentation built on Dec. 23, 2021, 8:48 a.m.