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

Safe Haskell | None
Language | Haskell98

Graphics.Rendering.Chart.Plot.Histogram

Contents

- Histograms
- Accessors

Synopsis

- data PlotHist x y = PlotHist {
  - _plot_hist_title :: String
  - _plot_hist_bins :: Int
  - _plot_hist_values :: [x]
  - _plot_hist_no_zeros :: Bool
  - _plot_hist_range :: Maybe (x, x)
  - _plot_hist_drop_lines :: Bool
  - _plot_hist_fill_style :: FillStyle
  - _plot_hist_line_style :: LineStyle
  - _plot_hist_norm_func :: Double -> Int -> y
  }
- histToPlot :: (RealFrac x, Num y, Ord y) => PlotHist x y -> Plot x y
- defaultPlotHist :: PlotHist x Int
- defaultFloatPlotHist :: PlotHist x Double
- defaultNormedPlotHist :: PlotHist x Double
- histToBins :: (RealFrac x, Num y, Ord y) => PlotHist x y -> [((x, x), y)]
- plot_hist_title :: forall x y f. Functor f => (String -> f String) -> PlotHist x y -> f (PlotHist x y)
- plot_hist_bins :: forall x y f. Functor f => (Int -> f Int) -> PlotHist x y -> f (PlotHist x y)
- plot_hist_values :: forall x y f. Functor f => ([x] -> f [x]) -> PlotHist x y -> f (PlotHist x y)
- plot_hist_no_zeros :: forall x y f. Functor f => (Bool -> f Bool) -> PlotHist x y -> f (PlotHist x y)
- plot_hist_range :: forall x y f. Functor f => (Maybe (x, x) -> f (Maybe (x, x))) -> PlotHist x y -> f (PlotHist x y)
- plot_hist_drop_lines :: forall x y f. Functor f => (Bool -> f Bool) -> PlotHist x y -> f (PlotHist x y)
- plot_hist_line_style :: forall x y f. Functor f => (LineStyle -> f LineStyle) -> PlotHist x y -> f (PlotHist x y)
- plot_hist_fill_style :: forall x y f. Functor f => (FillStyle -> f FillStyle) -> PlotHist x y -> f (PlotHist x y)
- plot_hist_norm_func :: forall x y1 y2 f. Functor f => ((Double -> Int -> y1) -> f (Double -> Int -> y2)) -> PlotHist x y1 -> f (PlotHist x y2)

# Histograms

data PlotHist x y #

Constructors

PlotHist |
Fields _plot_hist_title :: String Plot title _plot_hist_bins :: Int Number of bins _plot_hist_values :: [x] Values to histogram _plot_hist_no_zeros :: Bool Don't attempt to plot bins with zero counts. Useful when the y-axis is logarithmically scaled. _plot_hist_range :: Maybe (x, x) Override the range of the histogram. If `Nothing` the range of `_plot_hist_values` is used. Note that any normalization is always computed over the full data set, including samples not falling in the histogram range. _plot_hist_drop_lines :: Bool Plot vertical lines between bins _plot_hist_fill_style :: FillStyle Fill style of the bins _plot_hist_line_style :: LineStyle Line style of the bin outlines _plot_hist_norm_func :: Double -> Int -> y Normalization function

#### Instances

Instances details

Default (PlotHist x Int) # |
Instance details Defined in Graphics.Rendering.Chart.Plot.Histogram Methods def :: PlotHist x Int #

histToPlot :: (RealFrac x, Num y, Ord y) => PlotHist x y -> Plot x y #

Convert a `PlotHist` to a `Plot`

N.B. In principle this should be Chart's `ToPlot` class but unfortunately this does not allow us to set bounds on the x and y axis types, hence the need for this function.

defaultPlotHist :: PlotHist x Int #

The default style is an unnormalized histogram of 20 bins.

defaultFloatPlotHist :: PlotHist x Double #

`defaultPlotHist` but with real counts

defaultNormedPlotHist :: PlotHist x Double #

`defaultPlotHist` but normalized such that the integral of the histogram is one.

histToBins :: (RealFrac x, Num y, Ord y) => PlotHist x y -> [((x, x), y)] #

Obtain the bin dimensions of a given `PlotHist`.

# Accessors

plot_hist_title :: forall x y f. Functor f => (String -> f String) -> PlotHist x y -> f (PlotHist x y) #

plot_hist_bins :: forall x y f. Functor f => (Int -> f Int) -> PlotHist x y -> f (PlotHist x y) #

plot_hist_values :: forall x y f. Functor f => ([x] -> f [x]) -> PlotHist x y -> f (PlotHist x y) #

plot_hist_no_zeros :: forall x y f. Functor f => (Bool -> f Bool) -> PlotHist x y -> f (PlotHist x y) #

plot_hist_range :: forall x y f. Functor f => (Maybe (x, x) -> f (Maybe (x, x))) -> PlotHist x y -> f (PlotHist x y) #

plot_hist_drop_lines :: forall x y f. Functor f => (Bool -> f Bool) -> PlotHist x y -> f (PlotHist x y) #

plot_hist_line_style :: forall x y f. Functor f => (LineStyle -> f LineStyle) -> PlotHist x y -> f (PlotHist x y) #

plot_hist_fill_style :: forall x y f. Functor f => (FillStyle -> f FillStyle) -> PlotHist x y -> f (PlotHist x y) #

plot_hist_norm_func :: forall x y1 y2 f. Functor f => ((Double -> Int -> y1) -> f (Double -> Int -> y2)) -> PlotHist x y1 -> f (PlotHist x y2) #