barplot | R Documentation |
Displays a compositional bar chart.
## S4 method for signature 'CompositionMatrix'
barplot(
height,
...,
select = NULL,
by = groups(height),
order_columns = FALSE,
order_rows = NULL,
decreasing = TRUE,
space = 0.2,
offset = 0.025,
color = palette_color_discrete(),
border = NA,
axes = TRUE,
legend = TRUE
)
height |
A |
... |
Further parameters to be passed to |
select |
A vector of column indices. |
by |
A |
order_columns |
A |
order_rows |
An |
decreasing |
A |
space |
A length-one |
offset |
A length-one |
color |
A palette |
border |
The color to draw the borders. |
axes |
A |
legend |
A |
barplot()
is called for its side-effects: is results in a graphic being
displayed (invisibly return height
).
N. Frerebeau
Other plot methods:
as_graph()
,
hist()
,
plot()
,
plot_logratio
## Data from Aitchison 1986
data("hongite")
## Coerce to compositional data
coda <- as_composition(hongite)
## Bar plot
barplot(coda)
## Data from Day et al. 2011
data("kommos", package = "folio")
kommos <- remove_NA(kommos, margin = 1) # Remove cases with missing values
coda <- as_composition(kommos, groups = 1) # Coerce to compositional data
## Use ceramic types for grouping
barplot(coda, order_columns = TRUE)
## Display only minor elements
barplot(coda, select = is_element_minor(coda), order_columns = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.