PlotFdist(x, main = deparse(substitute(x)), xlab = "", xlim = NULL,
do.hist = !(all(IsWhole(x, na.rm = TRUE)) & length(unique(na.omit(x))) < 13),
args.hist = NULL, args.rug = NA, args.dens = NULL, args.curve = NA,
args.boxplot = NULL, args.ecdf = NULL, heights = NULL,
pdist = NULL, na.rm = FALSE, cex.axis = NULL, cex.main = NULL)
range(x, na.rm = TRUE)
.type = "h"
should be used.
Default is TRUE
(meaning a histogram will be plotted), unless x is an integer with less than 13 unique values!hist()
, ignored if do.hist = FALSE
.
The defaults chosen when setting args.hist = NULL
are more or less the same as in h
rug()
.
Use args.rug = NA
if no rug should be added. This is the default. Use args.rug = NULL
to add rug with reasonable default values.density
.
Use args.dens = NA
if no density curve should be drawn. The defaults are taken from density
.curve
.
This argument allows to add a fitted distribution curve to the histogram. By default no curve will be added (args.curve = NA). If the argument is set to boxplot()
.
The defaults are pretty much the same as in boxplot
.ecdf()
.
Use args.ecdf = NA
if no empirical cumulation function should be included in the plot.
The defaults are taken from plot.ecdf
c(2,0.5,1.4)
for the histogram, the boxplot
and the empirical cumulative distribution function, resp. to c(2,1.5)
for a histogram and a boxplot only.c(0, 0)
, say there will be no distance between the histogram, the boxplot and the ecdf-plot. This can be changed for instance in case that the xaxis is to
be added to the histogram.FALSE
.hist
, boxplot
, ecdf
, density
, rug
, layout
# create a new window and do the plot
PlotFdist(x=d.pizza$delivery_min, na.rm=TRUE)
# define additional arguments for hist and dens
PlotFdist(d.pizza$delivery_min, args.hist=list(breaks=50),
args.dens=list(col="olivedrab4"), na.rm=TRUE )
# do a "h"-plot instead of a histogram for integers
PlotFdist(d.pizza$weekday, na.rm=TRUE)
# special arguments for ecdf
PlotFdist(x=faithful$eruptions, args.ecdf=list(verticals=FALSE,
do.points=TRUE, cex=1.2, pch=16, lwd=1), args.rug=NULL)
# no density curve, no ecdf but add rug instead, make boxplot a bit higher
PlotFdist(x=d.pizza$delivery_min, na.rm=TRUE, args.dens=NA, args.ecdf=NA,
args.hist=list(xaxt="s"), # display x-axis on the histogram
args.rug=TRUE, heights=c(3, 2.5), pdist=2.5, main="Delivery time")
# alpha channel on rug is cool, but takes its time for being drawn...
PlotFdist(x=d.pizza$temperature, args.rug=list(col=SetAlpha("black", 0.1)), na.rm=TRUE)
# plot a normal density curve
x <- rnorm(1000)
PlotFdist(x, args.curve = NULL, args.boxplot=NA, args.ecdf=NA)
# compare with a t-distribution
PlotFdist(x, args.curve = list(expr="dt(x, df=2)", col="darkgreen"),
args.boxplot=NA, args.ecdf=NA)
legend(x="topright", legend=c("kernel density", "t-distribution (df=2)"),
fill=c(hred, "darkgreen"))
Run the code above in your browser using DataLab