rug                 package:graphics                 R Documentation

Add a Rug to a Plot

Description:

     Adds a _rug_ representation (1-d plot) of the data to the plot.

Usage:

     rug(x, ticksize=0.03, side=1, lwd=0.5, col,
         quiet = getOption("warn") < 0, ...)

Arguments:

       x: A numeric vector

ticksize: The length of the ticks making up the 'rug'. Positive lengths
          give inwards ticks.

    side: On which side of the plot box the rug will be plotted.
          Normally 1 (bottom) or 3 (top).

     lwd: The line width of the ticks.

     col: The colour the ticks are plotted in, default is black.

   quiet: logical indicating if there should be a warning about clipped
          values.

     ...: further arguments, passed to 'axis(...)', such as 'line' or
          'pos' for specifying the location of the rug.

Details:

     Because of the way 'rug' is implemented, only values of 'x' that
     fall within the plot region are included.  There will be a warning
     if any finite values are omitted, but non-finite values are
     omitted silently.

     Because of the way colours are done the axis itself is coloured
     the same as the ticks.  You can always replot the box in black if
     you don't like this feature.

References:

     Chambers, J. M. and Hastie, T. J. (1992) _Statistical Models in
     S._ Wadsworth & Brooks/Cole.

See Also:

     'jitter' which you may want for ties in 'x'.

Examples:

     data(faithful)
     with(faithful, {
         plot(stats::density(eruptions, bw=0.15))
         rug(eruptions)
         rug(jitter(eruptions, amount = .01), side = 3, col = "light blue")
     })

