R: Plot Frequency Polygons

plotpolygon {kpeaks} | R Documentation

## Plot Frequency Polygons

### Description

Plots the frequency polygon and histogram of a feature with some options.

### Usage

    plotpolygon(x, nbins, ptype, bcol = "gray", pcol = "blue")

### Arguments

`x` | a numeric vector containing the observations of a feature, or a numeric matrix when `ptype` is sp.
`nbins` | an integer for the number of classes in the frequency polygon.
`bcol` | a string for the color of bins. Default is gray.
`pcol` | a string for the color of polygon lines. Default is blue.
`ptype` | a string specifying the type of plot. Use p for plotting the polygon only or ph for plotting the polygon with the histogram. Default is sp for the scatterplots between the pairs of features and the polygons on the diagonal panel.

### Author(s)

Zeynel Cebeci, Cagatay Cebeci

### See Also

`genpolygon`

### Examples

    # plot the frequency polygon of the 2nd feature in x5p4c data set
    data(x5p4c)
    hvals <- genpolygon(x5p4c[,2], binrule="usr", nbins=20)

    # plot the frequency polygon of the 2nd feature in x5p4c data set
    plotpolygon(x5p4c[,2], nbins=hvals$nbins, ptype="p")

    # plot the histogram and frequency polygon of the 2nd feature in x5p4c data set
    plotpolygon(x5p4c[,2], nbins=hvals$nbins, ptype="ph", bcol="orange", pcol="blue")

    # plot the pairwise scatter plots of the features in x5p4c data set
    pairs(x5p4c, diag.panel=plotpolygon, upper.panel=NULL, cex.labels=1.5)

    # plot the histogram and frequency polygon of Petal.Width in iris data set
    data(iris)
    hvals <- genpolygon(iris$Petal.Width, binrule="doane")
    plotpolygon(iris$Petal.Width, nbins=hvals$nbins, ptype="ph")

[Package kpeaks version 0.1.0 Index]