mhist: Histograms

View source: R/mhist.R

mhistR Documentation

Histograms

Description

Draws a histogram using lines.

Usage

mhist(
  x,
  breaks = "Sturges",
  measure = c("density", "counts"),
  lwd = 3,
  xlim = NULL,
  ylim = NULL,
  plot.axes = FALSE,
  xaxis = TRUE,
  yaxis = TRUE,
  xaxis.line = 0,
  yaxis.line = 0,
  xlab = NULL,
  ylab = measure,
  xaxs = "r",
  yaxs = "r",
  box = FALSE,
  grid = FALSE,
  col = pennCol$lighterBlue,
  horiz = FALSE,
  main = "",
  add = FALSE,
  ...
)

Arguments

x

Input vector

breaks

See hist("breaks") Default = "Sturges"

measure

Character: "density"(Default), "counts"

lwd

Float: Line width

xlim

Vector, length 2: x-axis limits

ylim

Vector, length 2: y-axis limits

plot.axes

Logical: If TRUE, draws plot axes. Separate from xaxis and yaxis

xaxis

Logical: If TRUE, draws x-axis

yaxis

Logical: If TRUE, draws y-axis

xaxis.line

Float: Number of lines into the margin to position xaxis. See axis("line")

yaxis.line

Float: Number of lines into the margin to position yaxis. See axis("line")

xlab

Character: x-axis label

ylab

Character: y-axis label

xaxs

Character: 'r' (Default): Extends x-axis range by 4 percent at each end, 'i': Does not extend x-axis range

yaxs

Character: 'r' (Default): Extends y-axis range by 4 percent at each end, 'i': Does not extend y-axis range

box

Logical: If TRUE, draws a box around plot

grid

Logical: If TRUE, draws a grid

col

Color to use for histogram lines

horiz

Logical: If TRUE, switches x and y axes. Important: Provide all other arguments as if for a non-rotated plot - i.e. xlab will become the y-axis label

main

Character: Main title

add

Logical: If TRUE, add histogram to existing plot (Caution: make sure the axes line up!)

...

Additional arguments to be passed to graphics::plot

Details

Using horiz = TRUE, you can draw vertical histograms (as used by mplot3_xym)

Author(s)

E.D. Gennatas


egenn/rtemis documentation built on Oct. 28, 2024, 6:30 a.m.