gghist function

Histogram of a Monte Carlo Simulation (ggplot version)

Histogram of a Monte Carlo Simulation (ggplot version)

Shows histogram of a mcnode or a mc object by ggplot framework.

gghist(x, ...) ## S3 method for class 'mcnode' gghist( x, griddim = NULL, xlab = names(x), ylab = "Frequency", main = "", bins = 30, which = NULL, ... ) ## S3 method for class 'mc' gghist( x, griddim = NULL, xlab = names(x), ylab = "Frequency", main = "", bins = 30, ... )

Arguments

  • x: an mc or an mcnode object
  • ...: Further arguments to be passed to geom_histogram()
  • griddim: A vector of two integers, indicating the size of the grid of the graph. If NULL, the grid is calculated to produce a "nice" graph.
  • xlab: Vector of labels for the x-axis. If NULL, use the name of the node.
  • ylab: Vector of labels for the y-axis.
  • main: Vector of main titles of the graph
  • bins: Number of bins. Defaults to 30.
  • which: An argument used for a multivariate mcnode. Can specify which variate plot to display. When variates are more than one, the output will be saved in a plot list by default or use the number of which variate to display.

Returns

a ggplot object.

Examples

data(total) # When mcnode has one variate gghist(xV) # When mcnode has two variates, the two plots will be saved in a list # if affected to a variable gplots <- gghist(xVUM) # show the first variate plot of xVUM mcnode gplots[[1]] # directly show the first variate plot of xVUM mcnode gghist(xVUM, which = 1) #directly show the first variate plot of xVUM mcnode # Post process gplots[[1]] + ggplot2::geom_histogram(color = "red",fill="blue")

See Also

[hist.mc()]

Author(s)

Yu Chen and Regis Pouillot

  • Maintainer: Regis Pouillot
  • License: GPL (>= 2)
  • Last published: 2024-06-05

Useful links