addScatter | R Documentation |
Add a scatter plot layer to a ggplot
object
addScatter(
data = NULL,
metaData = NULL,
x = NULL,
y = NULL,
caption = NULL,
color = NULL,
shape = NULL,
size = NULL,
linetype = 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 |
y |
Numeric values to plot along the |
caption |
Optional character values defining the legend captions of the plot. |
color |
Optional character values defining the colors of the plot layer.
See |
shape |
Optional character values defining the shapes/symbols of the plot layer.
See enum |
size |
Optional numeric values defining the size of the plot layer. |
linetype |
Optional character values defining the linetype of the plot layer.
See enum |
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()
,
addRibbon()
,
initializePlot()
# Add scatter using x and y
addScatter(x = c(1, 2, 1, 2, 3), y = c(5, 0, 2, 3, 4))
# Add scatter using a data.frame
time <- seq(0, 30, 0.1)
scatterData <- data.frame(x = time, y = cos(time))
addScatter(
data = scatterData,
dataMapping = XYGDataMapping$new(x = "x", y = "y")
)
# Or for simple cases a smart mapping will get directly x and y from data
addScatter(data = scatterData)
# Add a scatter with caption
addScatter(data = scatterData, caption = "My scatter plot")
# Add a scatter with specific properties
addScatter(
data = scatterData,
color = "blue", shape = "diamond", size = 2, caption = "My data"
)
# Add a scatter with specific properties
p <- addScatter(
data = scatterData,
color = "blue", shape = "diamond", size = 2, caption = "My data"
)
addScatter(
x = c(0, 1), y = c(1, 0),
color = "red", shape = "circle", size = 3,
plotObject = p
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.