fill_area {plotfunctions}R Documentation

Utility function

Description

Fill area under line or plot.

Usage

fill_area(
  x,
  y,
  from = 0,
  col = "black",
  alpha = 0.25,
  border = NA,
  na.rm = TRUE,
  horiz = TRUE,
  outline = FALSE,
  ...
)

Arguments

x

Vector with values on x-axis.

y

Vector with values on y-axis.

from

A number indicating until which value on the y-axis the graph is colored. Defaults to 0.

col

Color for filling the area. Default is black.

alpha

Transparency of shaded area. Number between 0 (completely transparent) and 1 (not transparent). Default is .25.

border

A color, indicating the color of the border around shaded area. No border with value NA (default).

na.rm

Logical: whether or not to remove the missing values in x and y. Defaults to TRUE. If set to FALSE, missing values may cause that the filled area is split in various smaller areas.

horiz

Logical: whether or not to plot with respect to the x-axis (TRUE) or y-xis (FALSE). Defaults to TRUE.

outline

Logical: whether or not to draw the outline instead of only the upper border of the shape. Default is FALSE (no complete outline).

...

Optional arguments for the lines. See par.

Author(s)

Jacolien van Rij

See Also

check_normaldist

Other Functions for plotting: addInterval(), add_bars(), add_n_points(), alphaPalette(), alpha(), check_normaldist(), color_contour(), dotplot_error(), drawDevArrows(), emptyPlot(), errorBars(), getCoords(), getFigCoords(), getProps(), gradientLegend(), legend_margin(), marginDensityPlot(), plot_error(), plot_image(), plotsurface(), sortBoxplot()

Examples

# density of a random sample from normal distribution:
test <- density(rnorm(1000))
emptyPlot(range(test$x), range(test$y))
fill_area(test$x, test$y)
fill_area(test$x, test$y, from=.1, col='red')
fill_area(test$x, test$y, from=.2, col='blue', density=10, lwd=3)
lines(test$x, test$y, lwd=2)


[Package plotfunctions version 1.4 Index]