Learn R Programming

animalEKF (version 1.3)

rug_multicolor: Multicolor rug of tick marks.

Description

Adapt rug function to allow tick marks to be of different colors.

Usage

rug_multicolor(x, plot_side=3, ticksize=-0.04, col_vec=rep(1, length(x)))

Arguments

x

Numeric vector of axis tick mark locations.

plot_side

Which side to plot on. 1=bottom, 2=left, 3=top, and 4=right.

ticksize

Size of tick marks. Negative values mean ticks are on outside of plot. This feeds into the tck parameter of the axis function.

col_vec

Vector of color definitions, corresponding to each value of x.

Author

Samuel Ackerman

Examples

Run this code

d <- data.frame(X=runif(20), Y=runif(20))
plot(d, xlim=c(0,1), ylim=c(0,1))

# draw rug of ticks on each axis where the coordinates are
rug_multicolor(x=d$X, col_vec=colorspace::rainbow_hcl(n=20), ticksize=-0.05)
rug_multicolor(x=d$Y, plot_side=4, col_vec=colorspace::rainbow_hcl(n=20), ticksize=-0.05)

Run the code above in your browser using DataLab