Plots histograms and kernel density estimates

Description

hist plots either one or two histograms and the according kernel density estimates using density.

This plotting routine extracts all the information from the input dataframe which has to be 'WUX-style' (see models2wux).

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'wux.df'
hist(x, datain2.df = NULL, var.name = "delta.air_temperature",
subreg.subset = NULL, season.subset = NULL, plot.density = TRUE,

hist1.col = "red", hist2.col = "blue", bw = "nrd0", kernel = "gaussian",
mark.df = NULL, plot.legend = FALSE,  xlim = NULL, ylim = NULL,
xtick.number = 10, ytick.number = 10, xminor.tick = FALSE, yminor.tick =
FALSE, xlab = NULL, ylab = "Probability Density", main =
NULL, out.file.directory = NULL, out.file.name = NULL, copyright = FALSE, ...)

Arguments

x

1st WUX dataframe obtained from models2wux.

datain2.df

2nd WUX dataframe obtained from models2wux.

var.name

Character string of parameter in WUX dataset. Default is temperature change.

subreg.subset

Vector of subregions to be plotted (e.g. c("EU.ENS", "GAR")).

season.subset

Vector of seasons to be plotted (e.g. c("MAM", "DJF")).

plot.density

Boolean. Indicating if kernel density estimates should be plotted. Default is TRUE.

hist1.col

Character string of the 1st histogram color (e.g. "red").

hist2.col

Character string of the 2nd histogram color (e.g. "blue").

bw

The smoothing bandwidth to be used in density. Default is "nrd0".

kernel

A character string giving the smoothing kernel to be used in density. This must be one of "gaussian", "rectangular", "triangular", "epanechnikov","biweight", "cosine" or "optcosine" with default "gaussian".

mark.df

Subset of WUX dataframe indicating the models to be marked.

plot.legend

Boolean. Indicating if a plot legend indicating the models of mark.df and sample size should be plotted. Default is FALSE.

xlim

Range vector for the x-axis.

ylim

Range vector for the y-axis.

xtick.number

Number of ticks for the x-axis with default 10.

ytick.number

Number of ticks for the y-axis with default 10.

xminor.tick

Boolean. Indicating if minor ticks for the x-axis should be plotted. Default is FALSE.

yminor.tick

Boolean. Indicating if minor ticks for the y-axis should be plotted. Default is FALSE.

xlab

Label for x-axis.

ylab

Label for y-axis with default Probability Density.

main

Main title.

out.file.directory

String of the directory where the plots are exported (e.g. "/tmp/plots/"). If neither out.file.name nor out.file.directory are passed, the plot will be displayed on screen.

out.file.name

Prefix of the file names of the plots. Files will be stored as out.file.name_subreg_season.eps, where subreg is one realization of the subreg.subset argument and season is one realization of season.subset. For example: out.file.name = "histogram" will store to the files to histogram_EUROPE_DJF.eps and histogram_EUROPE_JJA.eps. If neither out.file.name nor out.file.directory are passed, the plot will be displyed on screen.

copyright

Boolean. If a copyright message should be plotted. Default is FALSE.

...

Further optional arguments passed to hist.

Author(s)

Georg Heinrich g.heinrich@uni-graz.at

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## load WUX and read WUX test data
require(wux)
data(ensembles)

wuxtest.df <- subset(ensembles, subreg == "GAR")

## set dataframe for model marks
mark.df <- subset(wuxtest.df, acronym %in% c("ICTP-REGCM3", "MPI-M-REMO"))
mark.df <- droplevels(mark.df)

## histogram plot
## Not run: hist(x = wuxtest.df, var.name =
  "perc.delta.precipitation_amount", xlim = c(-50,50), ylim = c(0,0.12),
  xtick.number = 9, xminor.tick = TRUE,  ytick.number = 5,
  yminor.tick = TRUE, xlab = "Precipitation Amount [%]", main =
  "WUX histogram", plot.legend = TRUE, mark.df = mark.df, hist1.col =
  "dark blue")

graphics.off()
## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.