Adds a vertical or horizontal filled bar at the specified x or y-axis coordinates.

fill_plot(x = NULL, y = NULL, l = NULL, border = NA, ...)

Arguments

x

A vector of two x-axis coordinates, or a N x 2 matrix, giving the left and right boundaries of the vertical bars to draw.

y

A vector of two y-axis coordinates, or a N x 2 matrix, giving the bottom and top boundaries of the horizontal bars to draw.

l

The limits for either 1) the height of the bar(s) (if x is not NULL), or 2) the width of the bar(s) (if y is not NULL).

border

The color of the border for the filled bar(s). If NA, no border is drawn.

...

Additional parameters to the function polygon.

Examples

# Create blank plot
xl <- c(0, 4)
yl <- c(0, 1)
plot_blank(xl, yl)
# Draw vertical grey bar
fill_plot(x = c(1, 2), l = yl, col = "grey90")
# Also set height and border of bar
fill_plot(x = c(3, 4), l = c(.25, .75), col = "grey80", border = "black")
# Draw horizontal bar
fill_plot(y = c(.9, 1), col = "black")


# Multiple bars can be draw at once
xl <- c(0, 4)
yl <- c(0, 1)
plot_blank(xl, yl)
# Multiple vertical bars
fill_plot(x = rbind(c(1, 2), c(3, 4)), l = yl, col = "grey90")
# Multiple horizontal bars
fill_plot(y = rbind(c(0, .05), c(.95, 1)), l = xl, col = "black")