Chart-1.8.2: A library for generating 2D Charts and Plots

Safe Haskell | None
Language | Haskell98

Numeric.Histogram

Synopsis

- type Range a = (a, a)
- binBounds :: RealFrac a => a -> a -> Int -> [Range a]
- histValues :: RealFrac a => a -> a -> Int -> [a] -> Vector (Range a, Int)
- histWeightedValues :: RealFrac a => a -> a -> Int -> [(Double, a)] -> Vector (Range a, Double)
- histWithBins :: (Num w, RealFrac a) => Vector (Range a) -> [(w, a)] -> Vector (Range a, w)

# Documentation

type Range a = (a, a) Source #

binBounds :: RealFrac a => a -> a -> Int -> [Range a] Source #

'binBounds a b n' generates bounds for `n` bins spaced linearly between `a` and `b`

Examples:

    >>> binBounds 0 3 4
    [(0.0,0.75),(0.75,1.5),(1.5,2.25),(2.25,3.0)]

histValues :: RealFrac a => a -> a -> Int -> [a] -> Vector (Range a, Int) Source #

'histValues a b n vs' returns the bins for the histogram of `vs` on the range from `a` to `b` with `n` bins

histWeightedValues :: RealFrac a => a -> a -> Int -> [(Double, a)] -> Vector (Range a, Double) Source #

'histValues a b n vs' returns the bins for the weighted histogram of `vs` on the range from `a` to `b` with `n` bins

histWithBins :: (Num w, RealFrac a) => Vector (Range a) -> [(w, a)] -> Vector (Range a, w) Source #

'histWithBins bins xs' is the histogram of weighted values `xs` with `bins`

Examples:

    >>> :{
    histWithBins
        (V.fromList [(0.0, 0.75), (0.75, 1.5), (1.5, 2.25), (2.25, 3.0)])
        [(1, 0), (1, 0), (1, 1), (1, 2), (1, 2), (1, 2), (1, 3)]
    :}
    [((0.0,0.75),2),((0.75,1.5),1),((1.5,2.25),3),((2.25,3.0),1)]