histGroup: plot histogram for multiple groups.

Description Usage Arguments Details Author(s) See Also Examples

View source: R/histGroup.r

Description

plot a histogram for multiple groups, each group colored individually

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
histGroup(
  data,
  groups,
  main = paste("Histogram of", dataname),
  xlab = dataname,
  ylab,
  col = NULL,
  alpha = 0.5,
  breaks = "Sturges",
  legend = TRUE,
  legend.x = 80,
  legend.y = 80,
  legend.pch = 15,
  freq = TRUE
)

Arguments

data

vector containing data.

groups

grouping factors

main, xlab, ylab

these arguments to title have useful defaults here.

col

vector containing color for each group. If NULL, the function "rainbow" is called.

alpha

numeric between 0 and 1. Sets the transparency of the colors

breaks

one of:

  • a vector giving the breakpoints between histogram cells,

  • a single number giving the number of cells for the histogram,

  • a character string naming an algorithm to compute the number of cells (see ‘Details’),

  • a function to compute the number of cells.

In the last three cases the number is a suggestion only.

legend

logical: if TRUE, a legend is plotted

legend.x

x position of the legend from the upper left corner

legend.y

y position of the legend from the upper left corners

legend.pch

integer: define the symbol to visualise group colors (points)

freq

logical: if TRUE, the histogram graphic is a representation of frequencies, the counts component of the result; if FALSE, probability densities are plotted for each group.

Details

Just a wrapper for the function hist from the "graphics" package

Author(s)

Stefan Schlager

See Also

hist

Examples

1
2
data(iris)
histGroup(iris$Petal.Length,iris$Species)

Morpho documentation built on Sept. 9, 2021, 9:07 a.m.