Displays a density plot.
Usage
# S4 method for class 'LogRatio,missing'
plot(
x,
...,
by = groups(x),
color = palette_color_discrete(),
rug = TRUE,
ticksize = 0.05,
ncol = NULL,
flip = FALSE,
xlab = NULL,
ylab = NULL,
main = NULL,
ann = graphics::par("ann"),
axes = TRUE,
frame.plot = axes,
legend = list(x = "top")
)
Arguments
- x
A
LogRatio
object.- ...
Further graphical parameters, particularly,
border
andcol
.- by
A
vector
of grouping elements, as long as the variables inx
. If set, a matrix of panels defined bygroups
will be drawn.- color
A palette
function
that when called with a single argument returns acharacter
vector of colors.- rug
A
logical
scalar: should a rug representation (1-d plot) of the data be added to the plot?- ticksize
A length-one
numeric
vector giving the length of the ticks making up the rug. Positive lengths give inwards ticks. Only used ifrug
isTRUE
.- ncol
An
integer
specifying the number of columns to use. Defaults to 1 for up to 4 groups, otherwise to 2.- flip
A
logical
scalar: should the y-axis (ticks and numbering) be flipped from side 2 (left) to 4 (right) from variable to variable?- xlab, ylab
A
character
vector giving the x and y axis labels.- main
A
character
string giving a main title for the plot.- ann
A
logical
scalar: should the default annotation (title and x and y axis labels) appear on the plot?- axes
A
logical
scalar: should axes be drawn on the plot?- frame.plot
A
logical
scalar: should a box be drawn around the plot?- legend
A
list
of additional arguments to be passed tographics::legend()
; names of the list are used as argument names. IfNULL
, no legend is displayed.
Value
plot()
is called for its side-effects: is results in a graphic being
displayed (invisibly return x
).
Examples
## Data from Day et al. 2011
data("kommos", package = "folio") # Coerce to compositional data
kommos <- remove_NA(kommos, margin = 1) # Remove cases with missing values
coda <- as_composition(kommos, groups = 1)
## Log ratio
clr <- transform_clr(coda)
## Density plot
plot(clr, by = NULL, flip = TRUE)
## Use ceramic types for grouping
plot(clr, flip = TRUE)