add_line | R Documentation |
xyplot
Include a line to an xyplot
by either including a slope and intercept
term or by clicking twice on the Plots pane in RStudio. After creating an
xyplot
, either run add_line()
with no arguments and then click
on the RStudio plot plane twice to draw a line OR include arguments for
slope
and intercept
to draw a specific line.
add_line(
intercept,
slope,
vline = NULL,
hline = NULL,
units = "native",
color = "red"
)
intercept |
Numerical (optional). The intercept term for a line to plot. |
slope |
color (optional). Sets color of the line to be drawn |
add_curve
data(cdc)
## Not run:
# Add a line by clicking on the plot pane
xyplot(weight ~ height, data = cdc)
add_line() # Click the Plots pane twice inorder to proceed.
## End(Not run)
# Specify a line using the slope and intercept arguments
xyplot(weight ~ height, data = cdc)
add_line(intercept = -180, slope = 165)
# Include a horizontal and/or vertical line
xyplot(weight ~ height, data = cdc)
add_line(vline = 1.6, hline = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.