histGroup: plot histogram for multiple groups.

View source: R/histGroup.r

histGroupR Documentation

plot histogram for multiple groups.

Description

plot a histogram for multiple groups, each group colored individually

Usage

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


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



Morpho documentation built on Feb. 16, 2023, 10:51 p.m.