The ErrorBars
module provides functions for
drawing graphs with errors bars. Suppose that
we have dome data:
> data = SampleData.errorBarData |> Data.fromString 0 1
Then
> ErrorBars.mean data
produces a list of ponts that pass through the mean values of data points with given x value. For error bars with extreme ponts one standard deviatoin from the mean, use
> ErrorBars.normal 1.0 data
For error bars with endpoints at the maximumn and minimum of the data with given x value, use
> ErrorBars.maxmin data
{ x : Basics.Float
, y : Basics.Float
, top : Basics.Float
, bottom : Basics.Float
}
The type of an error bar containing (x,y) with extreme points (x,top) and (x,bottom)
mean : Data -> Data
Use to compute the y-centroids of the data, as in this example:
> SampleData.errorBarData |> Data.fromString 0 1 |> ErrorBars.mean
[{ x = 0, y = 1 },{ x = 1, y = 2 }]
normal : Basics.Float -> Data -> List ErrorBar
Use to compute error bars, as in this example:
> SampleData.eberrorBarData2 |> Data.fromString 0 1 |> ErrorBars.normal 0.5
[{ bottom = 0.99667, y = 1, top = 1.003333, x = 0 }
,{ bottom = 1.98, y = 2, top = 2.02, x = 1 }]
maxmin : Data -> List ErrorBar
> SampleData.errorBarData |> Data.fromString 0 1 |> ErrorBars.maxmin
[{ bottom = 0.9, y = 1, top = 1.1, x = 0 }
,{ bottom = 1.8, y = 2, top = 2.2, x = 1 }]