Skip to contents

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 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.

Value

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

See also

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

Author

N. Frerebeau

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)