text | R Documentation |
Adding text inside of the plotting area. See text
for more details.
text(object, ...)
object |
gsplot object |
... |
Further graphical parameters may also be supplied as arguments. See 'Details'. |
Additional graphical parameter inputs:
x
numeric vector specifying x-coordinate(s) of text position(s)
y
numeric vector specifying y-coordinate(s) of text position(s)
labels
character vector of text for the plot
text
gs <- gsplot()
gsNew <- points(gs, y=1, x=2, col="blue", pch=18, legend.name="Points", xlab="Stuff")
gsNew <- lines(gsNew, c(3,4,3), c(2,4,6), legend.name="Lines", ylab="Data!")
gsNew <- text(gsNew, x=3.5, y=1.5, labels="Test")
gsNew <- abline(gsNew, b=1, a=0, legend.name="1:1")
gsNew <- legend(gsNew, location="topleft",title="Awesome!")
gsNew <- title(gsNew, main="Great Graph")
gsNew
gs <- gsplot() %>%
points( y=c(3,1,2), x=1:3, xlim=c(0,NA),ylim=c(0,NA),
col="blue", pch=18, legend.name="Points", xlab="Index") %>%
lines(c(3,4,3), c(2,4,6), legend.name="Lines", ylab="Data") %>%
abline(b=1, a=0, legend.name="1:1") %>%
legend(location="topleft",title="Awesome!") %>%
grid() %>%
error_bar(x=1:3, y=c(3,1,2), offset.up=c(0.5,0.25,1), offset.down=0.1) %>%
error_bar(x=1:3, y=c(3,1,2), offset.left=.2, x.high=.2, col="red",lwd=3) %>%
arrows(x0=c(0.75, 1.75), y0=c(2,2.5), x1=c(1,2), y1=c(2.8,1.4), lwd=2) %>%
text(x=c(0.75, 1.75), y=c(1.75, 2.8),labels=c("Weird data", "Other Data")) %>%
title("Graphing Fun")
gs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.