A convenience function making a call to hist with changes to the default options for parameters for pretty plotting.

plot_histogram(
  x,
  breaks = "FD",
  border = "grey",
  col = "grey",
  main = "",
  plot = TRUE,
  output = FALSE,
  new = TRUE,
  w = 5,
  h = 5,
  raw_points = TRUE,
  ...
)

Arguments

x

A vector of numeric values.

breaks

The argument controlling breakpoints passed to the hist function - by default uses the Freedman-Diaconis algorithm to find the optimal number of breakpoints.

border

The color of the border around the bars.

col

The color used to fill the bars.

main

The main title for the figure.

plot

Logical; if TRUE generates a figure.

output

Logical; if TRUE returns the output from the hist function. Set to TRUE if plot is FALSE.

new

Logical; if TRUE generates a new plotting window via a call to x11.

w

The width (in inches) of the new plotting window.

h

The height (in inches) of the new plotting window.

raw_points

Logical; if TRUE adds a bar for individual data points at the bottom of the figure.

...

Additional arguments to pass to the hist function.

Value

If output is TRUE, returns a list with the information used to create the histogram - see the help page for the hist function for more details.

Examples

x <- rnorm( 100 )
plot_histogram( x, new = FALSE )