barplot {nexus} | R Documentation |
Barplot of Compositional Data
Description
Displays a compositional bar chart.
Usage
## S4 method for signature 'CompositionMatrix'
barplot(
height,
...,
order = NULL,
decreasing = FALSE,
groups = get_groups(height),
horiz = TRUE,
xlab = NULL,
ylab = NULL,
main = NULL,
sub = NULL,
ann = graphics::par("ann"),
axes = TRUE,
col = grDevices::hcl.colors(ncol(height), "viridis"),
legend = list()
)
Arguments
height |
A |
... |
Further parameters to be passed to |
order |
An |
decreasing |
A |
groups |
A |
horiz |
A |
xlab , ylab |
A |
main |
A |
sub |
A |
ann |
A |
axes |
A |
col |
A vector of colors for the bar components. |
legend |
A |
Value
barplot()
is called for its side-effects: is results in a graphic being
displayed (invisibly return height
).
Author(s)
N. Frerebeau
See Also
Other plot methods:
as_graph()
,
hist()
,
plot_logratio
,
plot()
Examples
## Data from Aitchison 1986
data("hongite")
## Coerce to compositional data
coda <- as_composition(hongite)
## Bar plot
barplot(coda, order = 2)
## 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) # Use ceramic types for grouping
barplot(coda, order = 1)
barplot(coda, order = 1, horiz = FALSE)