| yardstick | R Documentation | 
Create spatial objects that represent a text string, an arrow, or a yardstick (scale bar).
textstring(x, y, txt = NULL, ...)
onearrow(x0, y0, x1, y1, txt = NULL, ...)
yardstick(x0, y0, x1, y1, txt = NULL, ...)
| x,y | Coordinates where the text should be placed. | 
| x0,y0,x1,y1 | Spatial coordinates of both ends of the arrow or yardstick.
Alternatively  | 
| txt | The text to be displayed beside the line segment. Either a character string or an expression. | 
| ... | Additional named arguments for plotting the object. | 
These commands create objects that represent components of a diagram:
textstring creates an object that represents a string
of text at a particular spatial location.
onearrow creates an object that represents an arrow
between two locations.
yardstick creates an object that represents
a scale bar: a line segment indicating the scale of the plot.
To display the relevant object, it should be plotted, using
plot. See the help files for the plot methods
plot.textstring, plot.onearrow
and plot.yardstick.
These objects are designed to be included as components in a
layered object or a solist. This makes it
possible to build up a diagram consisting of many spatial objects,
and to annotate the diagram with arrows, text and so on, so that
ultimately the entire diagram is plotted using plot.
An object of class "diagramobj" which also
belongs to one of the special classes "textstring", "onearrow"
or "yardstick". There are methods for plot,
print, "[" and shift.
.
plot.textstring,
plot.onearrow,
plot.yardstick.
  X <- rescale(swedishpines)
  plot(X, pch=16, main="")
  yd <- yardstick(0,0,1,1, "diagonal")
  yy <- yardstick(X[1:2])
  ys <- yardstick(as.psp(list(xmid=4, ymid=0.5, length=1, angle=0),
                         window=Window(X)),
                  txt="1 m")
  ys
  plot(ys, angle=90)
  scalardilate(ys, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.