add_lines | R Documentation |
Add a lineplot of the *x_key* and *y_key* columns in *data* to the supplied ggplot object *ax*. If none is supplied, a new one is created.
add_lines(
data,
ax = NULL,
y_key = "dBM_smooth",
x_key = "DOY",
style = "line",
label = NULL,
...
)
data |
data.frame or similar object interpretable by ggplot. |
ax |
list as returned by ggplot() and related functions. |
x_key , y_key |
Column names in *data* to be plotted. |
style |
XXX in ggplot geom_XXX to use. |
label |
Codename for this line to be used in legend creation. If NULL, use *y_key*. |
... |
All further arguments are passed to the selected ggplot geom. |
ax A ggplot list (like the input *ax*).
library(ggplot2)
# Add first set of data
ax = add_lines(mtcars, x_key = "wt", y_key = "mpg", label = "First Line")
# Add one more line to the plot
ax = add_lines(mtcars, ax = ax, x_key = "wt", y_key = "qsec",
label = "Second Line")
print(ax)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.