Learn R Programming

nexus (version 0.3.0)

plot_logratio: Plot Log-Ratios

Description

Displays a density plot.

Usage

# S4 method for 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")
)

Value

plot() is called for its side-effects: is results in a graphic being displayed (invisibly return x).

Arguments

x

A LogRatio object.

...

Further graphical parameters, particularly, border and col.

by

A vector of grouping elements, as long as the variables in x. If set, a matrix of panels defined by groups will be drawn.

color

A palette function that when called with a single argument returns a character 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 if rug is TRUE.

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 to graphics::legend(); names of the list are used as argument names. If NULL, no legend is displayed.

Author

N. Frerebeau

See Also

Other plot methods: as_graph(), barplot(), hist(), plot()

Examples

Run this code
## 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)

Run the code above in your browser using DataLab