addRibbon | R Documentation |
Add a ribbon layer to a ggplot
object.
addRibbon(
data = NULL,
metaData = NULL,
x = NULL,
ymin = NULL,
ymax = NULL,
caption = NULL,
fill = NULL,
color = NULL,
size = NULL,
linetype = NULL,
alpha = NULL,
dataMapping = NULL,
plotConfiguration = NULL,
plotObject = NULL
)
data |
A data.frame to use for plot. |
metaData |
A named list of information about |
x |
Numeric values to plot along the |
ymin |
Numeric values to plot along the |
ymax |
Numeric values to plot along the |
caption |
Optional character values defining the legend captions of the plot. |
fill |
Optional character values defining the colors of the plot layer.
See |
color |
Optional character values defining the colors of the plot layer.
See |
size |
Optional numeric values defining the size of the plot layer. |
linetype |
Optional character values defining the linetype of the plot layer.
See enum |
alpha |
Numeric value between 0 and 1 corresponding to transparency of the ribbon. The closer to 0, the more transparent the ribbon is. The closer to 1, the more opaque the ribbon is. |
dataMapping |
A |
plotConfiguration |
An optional |
plotObject |
An optional |
A ggplot
object
For examples, see: https://www.open-systems-pharmacology.org/TLF-Library/articles/atom-plots.html
Other atom plots:
addErrorbar()
,
addLine()
,
addScatter()
,
initializePlot()
# Add ribbon using x, ymin and ymax
addRibbon(
x = c(1, 2, 1, 2, 3),
ymin = c(5, 0, 2, 3, 4),
ymax = c(6, 2, 6, 2.5, 5)
)
# Add ribbon using a data.frame
time <- seq(0, 30, 0.1)
ribbonData <- data.frame(x = time, ymin = cos(time) - 1, ymax = cos(time) + 1)
addRibbon(
data = ribbonData,
dataMapping = RangeDataMapping$new(x = "x", ymin = "ymin", ymax = "ymax")
)
# Or for simple cases a smart mapping will get directly x, ymin and ymax from data
addRibbon(data = ribbonData)
# Add a ribbon with caption
addRibbon(data = ribbonData, caption = "My ribbon plot")
# Add a ribbon with specific properties
addRibbon(data = ribbonData, fill = "blue", alpha = 0.5, caption = "My data")
# Add a ribbon with specific properties
p <- addRibbon(data = ribbonData, fill = "blue", alpha = 0.5, caption = "My data")
addRibbon(
x = c(0, 1), ymin = c(-0.5, -0.5), ymax = c(0.5, 0.5),
fill = "red", alpha = 1,
plotObject = p
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.