plot.rMix: 'plot' Method for 'rMix' Objects

Description Usage Arguments See Also Examples

View source: R/0_Mix_utils.R

Description

plot method for rMix objects, plotting the histogram of the random sample, with the option of additionally plotting the components (stacked or plotted over one another).

Usage

1
2
3
4
5
## S3 method for class 'rMix'
plot(x, xlab = attr(obj, "name"), ylim = NULL,
     main = paste("Histogram of", attr(obj, "name")), 
     breaks = NULL, col = "grey", components = TRUE, stacked = FALSE, 
     component.colors = NULL, freq = TRUE, plot = TRUE, ...)

Arguments

x

object of class rMix.

xlab

label for the x axis with default.

ylim

range of y values to use; if not specified (or containing NA), default values are used.

main

main title of the plot with default.

breaks

see hist. If left unspecified the function tries to construct reasonable default values.

col

a colour to be used to fill the bars of the histogram evaluated on the whole data.

components

logical indicating whether the plot should show to which component the observations belong (either by plotting individual histograms or by overlaying a stacked barplot), defaulting to TRUE. Ignored if plot is FALSE.

stacked

logical indicating whether the component plots should be stacked or plotted over one another, defaulting to FALSE. Ignored if components is FALSE or ignored itself.

component.colors

the colors for the component plots. If left unspecified default colors are used.

freq

logical, if TRUE, the histogram graphic is a representation of frequencies, if FALSE, probability densities. See hist.

plot

logical, if TRUE (default), a histogram is plotted, otherwise a list of breaks and counts is returned. See hist.

...

further arguments passed to the histogram function evaluated on the whole data as well as the component data (if components is TRUE and stacked is FALSE).

See Also

rMix for the creation of rMix objects.

Examples

1
2
3
4
5
6
7
# define 'Mix' object
normLocMix <- Mix("norm", w = c(0.3, 0.4, 0.3), mean = c(10, 13, 17), sd = c(1, 1, 1))

# generate n random samples
set.seed(1)
x <- rMix(1000, normLocMix)
plot(x)

anjaweigel/mixComp_package documentation built on Sept. 2, 2020, 3:55 p.m.