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

plot-histPlot

Histogram and Density Plots


Description

Returns a histogram, a density, or a logarithmic density plot.

List of Functions:

histPlot Returns a tailored histogram plot,
densityPlot Returns a tailored kernel density estimate plot,
logDensityPlot Returns a tailored log kernel density estimate plot.

Usage

histPlot(x, labels = TRUE, col = "steelblue", fit = TRUE, 
    title = TRUE, grid = TRUE, rug = TRUE, skip = FALSE, ...) 
densityPlot(x, labels = TRUE, col = "steelblue", fit = TRUE, hist = TRUE, 
    title = TRUE, grid = TRUE, rug = TRUE, skip = FALSE, ...)    
logDensityPlot(x, labels = TRUE, col = "steelblue", robust = TRUE,  
    title = TRUE, grid = TRUE, rug = TRUE, skip = FALSE, ...)

Arguments

col

the color for the series. In the univariate case use just a color name like the default, col="steelblue", in the multivariate case we recommend to select the colors from a color palette, e.g. col=heat.colors(ncol(x)).

fit

a logical flag, should a fit added to the Plot?

grid

a logical flag, should a grid be added to the plot? By default TRUE. To plot a horizontal lines only use grid="h" and for vertical lines use grid="h", respectively.

hist

a logical flag, by default TRUE. Should a histogram to be underlaid to the plot?

labels

a logical flag, should the plot be returned with default labels and decorated in an automated way? By default TRUE.

rug

a logical flag, by default TRUE. Should a rug representation of the data added to the plot?

skip

a logical flag, should zeros be skipped in the return Series?

robust

a logical flag, by default TRUE. Should a robust fit added to the plot?

title

a logical flag, by default TRUE. Should a default title added to the plot?

x

an object of class "timeSeries" or any other object which can be transformed by the function as.timeSeries into an object of class timeSeries. The latter case, other then timeSeries objects, is more or less untested.

...

optional arguments to be passed.

Value

displays a time series plot.

Examples

## data - 
   SPI <- LPP2005REC[, "SPI"]
   plot(SPI, type = "l", col = "steelblue", main = "SP500")
   abline(h = 0, col = "grey")
   
## histPlot -
   histPlot(SPI) 
   
## densityPlot -
   densityPlot(SPI)

fBasics

Rmetrics - Markets and Basic Statistics

v3042.89.1
GPL (>= 2)
Authors
Diethelm Wuertz [aut], Tobias Setz [cre], Yohan Chalabi [ctb] Martin Maechler [ctb]
Initial release
2017-11-12

We don't support your browser anymore

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