lines | R Documentation |
Creating a line by specifying specific plot points. See lines
for more details.
lines(object, ...)
object |
gsplot object |
... |
Further graphical parameters may also be supplied as arguments. See 'Details'. |
Additional graphical parameter inputs:
x
vector of x-coordinates for points that make up the line
y
vector of y-coordinates for points that make up the line
side
vector specifying the side(s) to use for axes (1,2,3,4 for sides, or 5,6,7,8 for outward offsets of those)
legend.name
name that appears in the legend, see legend
for more legend parameters
error_bar
add error bars to the defined line, see error_bar
for arguments, must add arguments as a list
callouts
add callouts and text to the defined line, see callouts
for arguments, must add arguments as a list
lines
gsNew <- gsplot()
gsNew <- lines(gsNew, c(1,2), y=c(2,5))
gsNew <- lines(gsNew, c(3,4,3), c(2,4,6), pch=6)
gsNew <- points(gsNew, c(8,4,1.2), c(2,4.7,6), side=c(3,2))
gsNew
# Same example using the magrittr pipe '%>%' to connect operations within gsplot
gsNewpipe <- gsplot() %>%
lines(c(1,2), c(2,5)) %>%
lines(c(3,4,3), c(2,4,6), pch=6) %>%
points(c(8,4,1.2), c(2,4.7,6), side=c(3,2))
gsNewpipe
gs <- gsplot() %>%
lines(x=c(1,2), y=c(4,2), xlim=c(0, 5), ylim=c(0,5),
callouts=list(labels=c(NA, "data"), col="blue"))
gs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.