Plot function that modifies and expands the graphics
package's matplot
function in several ways. First, either or both x
and y
arguments can be of class character
. In this case, axes labels corresponding to the unique values are used (see arguments xdomain
and ydomain
). Second, it allows for the specification of only a lower or upper limit in the xlim
and ylim
arguments. Third, it uses a cleaner plotting style and a default argument type = 'l'
(line plot) rather than type = 'p'
(point plot).
Usage
flexiplot(
x,
y,
xdomain = NULL,
ydomain = NULL,
xlim = NULL,
ylim = NULL,
type = "l",
pch = c(1, 0, 2, 5, 6, 3, 4),
grid = TRUE,
add = FALSE,
lwd = 1,
...
)
Arguments
- x
Numeric or character: vector of x-coordinates. If missing, a numeric vector
1:...
is created having as many values as the rows ofy
.- y
Numeric or character: vector of y coordinates. If missing, a numeric vector
1:...
is created having as many values as the rows ofx
.- xdomain
Character or numeric or
NULL
(default): vector of possible values of the variable represented in the x-axis, in case thex
argument is a character vector. The ordering of the values is respected. IfNULL
, thenunique(x)
is used.- ydomain
Character or numeric or
NULL
(default): likexdomain
but for the y-coordinate.- xlim
NULL
(default) or a vector of two values. In the latter case, if any of the two values is not finite (includingNA
orNULL
), then themin
ormax
x-coordinate of the plotted points is used.- ylim
NULL
(default) or a vector of two values. Like argumentxlim
, but for the y-coordinates.- grid
Logical: whether to plot a light grid. Default
TRUE
.- ...
Other parameters to be passed to
matplot
.