Learn R Programming

Luminescence (version 0.3.4)

plot_Histogram: Plot a histogram with a separate error plot

Description

Function plots a predefined histogram with an accompanying error plot as suggested by Rex Galbraith at the UK LED in Oxford 2010.

Usage

plot_Histogram(values, na.exclude = TRUE, mtext, cex.global, 
    breaks, se, rug, normal_curve, summary, summary.pos, colour, 
    ...)

Arguments

values
data.frame or RLum.Results object (required): for data.frame: two columns: De (values[,1]) and De error (values[,2])
na.exclude
logical (with default): excludes NA values from the data set prior to any further operations.
mtext
character (optional): further sample information (mtext).
cex.global
numeric (with default): global scaling factor.
breaks
(with default): sets breakpoints for histogram. Works as in hist.
se
logical (optional): plots standard error points over the histogram, default is FALSE.
rug
logical (optional): adds rugs to the histogram, default is TRUE.
normal_curve
logical (with default): adds a normal curve to the histogram. Mean and sd are calculated from the input data. More see details section.
summary
character (optional): adds numerical output to the plot. Can be one or more out of: "n" (number of samples), "mean" (mean De value), "median" (median of the De v
summary.pos
numeric (with default): optional position coordinates for the statistical summary. Y-coordinate refers to the right hand y-axis.
colour
numeric or character (with default): optional vector of length 4 which specifies the colours of the following plot items in exactly this order: histogram bars, rug
...
further arguments and graphical parameters passed to plot. If y-axis labels are provided, these must be specified as a vector of length 2 since the plot features two axes (e.g. ylab = c("axis label

Function version

0.4.1 (2014-04-13 14:30:27)

Details

If the normal curve is added, the y-axis in the histogram will show the probability density.

See Also

hist, plot

Examples

Run this code
## load data
data(ExampleData.DeValues, envir = environment())
ExampleData.DeValues <- 
  Second2Gray(values = ExampleData.DeValues, dose_rate = c(0.0438,0.0019))

## plot histogram the easiest way
plot_Histogram(ExampleData.DeValues)

## plot histogram with some more modifications
plot_Histogram(ExampleData.DeValues, 
               rug = TRUE, 
               normal_curve = TRUE, 
               cex.global = 0.9, 
               pch = 2,
               colour = c("grey", "black", "blue", "green"),
               summary = c("n", "mean", "sdrel"),
               summary.pos = "topleft",
               main = "Histogram of De-values",
               mtext = "Example data set", 
               ylab = c(expression(paste(D[e], "distribution")),
                        "Error"),
               xlim = c(100, 250),
               ylim = c(0, 0.08, 50, 200))

Run the code above in your browser using DataLab