Description Usage Arguments Details Value Author(s) See Also Examples
Label a Line Segment
1 2 3 |
P1 |
Point 1 c(x,y) |
P2 |
Point 2 c(x,y) |
above |
logical, TRUE=label above the line, else below |
dinch |
length the legs |
lab |
character, text label |
acode |
code for arrows, see arrows |
alength |
length for arrows |
aty |
lty for arrows |
acol |
color for arrows |
bty |
style for legs |
bcol |
color for legs |
tcol |
color for text |
font |
font for text |
cex |
character expansion for text, see par |
Two short lines are drawn perpendicular to the line between the points, the length of this line is dinch. The arrow is drawn between the legs, using the parameters provided.
graphical side effects
Jonathan M. Lees<jonathan.lees@unc.edu>
par, arrows, text
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | V1 = c(runif(1) , runif(1),runif(1) , runif(1))
P1 = c(V1[1], V1[3])
P2 = c(V1[2], V1[4])
plot(c(P1[1], P2[1]), c(P1[2], P2[2] ), asp=1, type='n' )
arrows(P1[1], P1[2], P2[1], P2[2], length=.04, col='red')
labelLine( P1, P2 , lab="ABOVE", dinch = .5,
aty=2, acol='blue' )
labelLine( P1, P2 , above=FALSE, lab="below",
dinch = .5, aty=2, acol='green', tcol="magenta" )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.