Learn R Programming

geophys (version 1.4-1)

labelLine: Label a Line Segment

Description

Label a Line Segment

Usage

labelLine(P1, P2, above = TRUE, dinch = 0.2, lab = "text",
 acode = 3, alength = 0.06, aty = 1, acol = "black", bty = 1,
 bcol = "black", tcol = "black", font = 1, cex = 1)

Arguments

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

Value

graphical side effects

Details

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.

See Also

par, arrows, text

Examples

Run this code
# NOT RUN {

 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"  )


 


# }

Run the code above in your browser using DataLab