Safe Haskell | None |
---|
This module contains the functions for plotting distributions using Gnuplot.
- plotDistribution :: PlottableDistribution dist => PlotParams -> dist -> IO ()
- data PlotParams = PlotParams {}
- data PicType
- plotFile :: String -> PicType -> PlotParams
- genPlotParams :: String -> a -> PlotParams
- class (Plottable (Datapoint dist), Plottable (Probability dist), Num (Probability dist), PDF dist, MaybeShow (Datapoint dist)) => PlottableDistribution dist where
- samplePoints :: dist -> [Datapoint dist]
- plotType :: dist -> PlotType
- pdfL :: dist -> [Probability dist]
- plotdata :: dist -> String
- class (Show t, Ord t) => Plottable t
- data PlotType
- = Bar
- | Points
- | Continuous
- samplesFromMinMax :: (Enum b, Fractional b) => b -> b -> [b]
Main interface
plotDistribution :: PlottableDistribution dist => PlotParams -> dist -> IO ()Source
Call this function to plot your distribution. You can create the PlotParams manually, or you can use default parameter creating function below.
Plot parameters
data PlotParams Source
plotFile :: String -> PicType -> PlotParamsSource
genPlotParams :: String -> a -> PlotParamsSource
provided due to backwards compatibility with the nuclear weapons blog post.
Internal
class (Plottable (Datapoint dist), Plottable (Probability dist), Num (Probability dist), PDF dist, MaybeShow (Datapoint dist)) => PlottableDistribution dist whereSource
In order to plot a distribution, it must be an instance of this class. You shouldn't need to know the details.
samplePoints :: dist -> [Datapoint dist]Source
plotType :: dist -> PlotTypeSource
pdfL :: dist -> [Probability dist]Source
(Ord label, Show label, Ord prob, Show prob, Fractional prob) => PlottableDistribution (Categorical prob label) | |
(PDF (Binomial prob dp), Show prob, Show dp, Ord dp, Ord prob, Num prob, Integral dp) => PlottableDistribution (Binomial prob dp) | |
(Floating prob, Enum prob, Show prob, Ord prob) => PlottableDistribution (Exponential prob prob) | |
(PDF (Geometric prob dp), Show prob, Show dp, Ord dp, Ord prob, Fractional prob, RealFrac prob, Integral dp) => PlottableDistribution (Geometric prob dp) | |
(Floating prob, Enum prob, Show prob, Ord prob) => PlottableDistribution (LogNormal prob prob) | |
(Floating prob, Enum prob, Show prob, Ord prob) => PlottableDistribution (Normal prob prob) | |
(PDF (Poisson prob dp), Show prob, Show dp, Ord dp, Ord prob, Fractional prob, Integral dp) => PlottableDistribution (Poisson prob dp) |
Utilities
samplesFromMinMax :: (Enum b, Fractional b) => b -> b -> [b]Source