Learn R Programming

adegraphics (version 1.0-4)

addhist: Adds histograms and density lines against a bi-dimensional graphics.

Description

Adds the two marginal histograms and density lines of each axis against an ADEg.S2 object.

Usage

addhist(object, bandwidth, gridsize = 60, kernel = "normal", cbreaks = 2, 
  storeData = TRUE, plot = TRUE, pos = -1, ...)

Arguments

object
an ADEg.S2 object
bandwidth
used for the calculations of the density lines (see the bkde function of the KernSmooth package).
gridsize
used for the calculations of the density lines (see the bkde function of the KernSmooth package).
kernel
used for the calculations of the density lines (see the bkde function of the KernSmooth package).
cbreaks
number of cells for the histograms per interval of the grid of the bi-dimensional graphics.
plot
a logical indicating if the graphics is displayed
storeData
a logical indicating if the data should be stored in the returned object. If FALSE, only the names of the data arguments are stored
pos
an integer indicating the position of the environment where the data are stored, relative to the environment where the function is called. Useful only if storeData is FALSE
...
Additional graphical parameters (see adegpar and trellis.par.get)

Value

  • An ADEgS object, a list of four graphical objects, one ADEg.S2 and three trellis (from lattice). Their names are:
  • objectthe ADEg.S2 object
  • densXtop histogram, a trellis object
  • densYright histogram, a trellis object
  • linkcorner graphics linking the two histograms, a trellis object

Details

Density is calculated using the function bkde of the KernSmooth package.

See Also

ADEg.S2 ADEgS

Examples

Run this code
data(rpjdl, package = "ade4")
coa1 <- ade4::dudi.coa(rpjdl$fau, scannf = FALSE, nf = 4)
labli <- s.label(coa1$li)
g1 <- addhist(labli)
g2 <- addhist(labli, plabels.cex = 0, cbreaks = 3)
labco <- s.label(coa1$co)
g3 <- addhist(labco, plabels.cex = 0, cbreaks = 3)
update(g3, pbackground.col = "grey85")

Run the code above in your browser using DataLab