Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.histde

Plot for histogram density estimate


Description

Plot for histogram density estimate for 1- and 2-dimensional data.

Usage

## S3 method for class 'histde'
plot(x, ...)

Arguments

x

object of class histde (output from histde)

...

other graphics parameters:

col

plotting colour for density estimate

col.fun

plotting colour function for levels

col.pt

plotting colour for data points

jitter

flag to jitter rug plot (1-d). Default is TRUE.

xlim,ylim

axes limits

xlab,ylab

axes labels

add

flag to add to current plot. Default is FALSE.

drawpoints

flag to draw data points on density estimate. Default is FALSE.

breaks

vector of break values of density estimate. Default is an nbreaks equilinear sequence over the data range.

nbreaks

number of breaks in breaks sequence

lty.rect,lwd.rect

line type/width for histogram box lines (2-d)

border

colour of histogram box lines (2-d)

col.rect

colour of histogram bars (1-d)

add.grid

flag to add histogram grid (2-d). Default is TRUE.

Details

For histde objects, the function headers for the different dimensional data are

## univariate
  plot(fhat, xlab, ylab="Density function", add=FALSE, drawpoints=FALSE,
     col.pt="blue", jitter=FALSE, border=1, ...) 
  
  ## bivariate
  plot(fhat, breaks, nbreaks=11, xlab, ylab, zlab="Density function", cex=1, 
     pch=1, add=FALSE, drawpoints=FALSE, col, col.fun, col.pt="blue",
     lty.rect=2, cex.text=1, border, lwd.rect=1, col.rect="transparent",
     add.grid=TRUE, ...)

The 1-d plot is a standard plot of a histogram generated by hist. If drawpoints=TRUE then a rug plot is added.

The 2-d plot is similar to the display="filled.contour" option from plot.kde with the default nbreaks=11 contour levels. Default colours are the default from the image command.

Value

Plots for 1-d and 2-d are sent to graphics window.

See Also

Examples

library(MASS)
data(iris)

## univariate example
fhat <- histde(x=iris[,2])
plot(fhat, border=3, xlab="Sepal length")

## bivariate example
fhat <- histde(x=iris[,2:3])
plot(fhat, drawpoints=TRUE)
box()

ks

Kernel Smoothing

v1.12.0
GPL-2 | GPL-3
Authors
Tarn Duong [aut, cre], Matt Wand [ctb], Jose Chacon [ctb], Artur Gramacki [ctb]
Initial release
2021-02-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.