Skip to content

Commit

Permalink
plotlyjs 2.26: Add [n]-sigma (std deviations) box plots
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Dec 7, 2023
1 parent 4497502 commit d1c63b9
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 147 deletions.
11 changes: 10 additions & 1 deletion src/Plotly.NET/ChartAPI/Chart2D.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3817,6 +3817,7 @@ module Chart2D =
/// <param name="Notched">Determines whether or not notches are drawn. Notches displays a confidence interval around the median. We compute the confidence interval as median +/- 1.57 " IQR / sqrt(N), where IQR is the interquartile range and N is the sample size. If two boxes' notches do not overlap there is 95% confidence their medians differ. See https://sites.google.com/site/davidsstatistics/home/notched-box-plots for more info. Defaults to "false" unless `notchwidth` or `notchspan` is set.</param>
/// <param name="NotchWidth">Sets the width of the notches relative to the box' width. For example, with 0, the notches are as wide as the box(es).</param>
/// <param name="QuartileMethod">Sets the method used to compute the sample's Q1 and Q3 quartiles. The "linear" method uses the 25th percentile for Q1 and 75th percentile for Q3 as computed using method #10 (listed on http://www.amstat.org/publications/jse/v14n3/langford.html). The "exclusive" method uses the median to divide the ordered dataset into two halves if the sample is odd, it does not include the median in either half - Q1 is then the median of the lower half and Q3 the median of the upper half. The "inclusive" method also uses the median to divide the ordered dataset into two halves but if the sample is odd, it includes the median in both halves - Q1 is then the median of the lower half and Q3 the median of the upper half.</param>
/// <param name="SizeMode">Sets the upper and lower bound for the boxes quartiles means box is drawn between Q1 and Q3 SD means the box is drawn between Mean +- Standard Deviation Argument sdmultiple (default 1) to scale the box size So it could be drawn 1-stddev, 3-stddev etc</param>
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
[<Extension>]
static member BoxPlot
Expand Down Expand Up @@ -3847,6 +3848,7 @@ module Chart2D =
[<Optional; DefaultParameterValue(null)>] ?Notched: bool,
[<Optional; DefaultParameterValue(null)>] ?NotchWidth: float,
[<Optional; DefaultParameterValue(null)>] ?QuartileMethod: StyleParam.QuartileMethod,
[<Optional; DefaultParameterValue(null)>] ?SizeMode: StyleParam.BoxSizeMode,
[<Optional; DefaultParameterValue(true)>] ?UseDefaults: bool
) =

Expand Down Expand Up @@ -3888,7 +3890,8 @@ module Chart2D =
?OffsetGroup = OffsetGroup,
?Notched = Notched,
?NotchWidth = NotchWidth,
?QuartileMethod = QuartileMethod
?QuartileMethod = QuartileMethod,
?SizeMode = SizeMode
)
)
|> GenericChart.ofTraceObject useDefaults
Expand Down Expand Up @@ -3923,6 +3926,7 @@ module Chart2D =
/// <param name="Notched">Determines whether or not notches are drawn. Notches displays a confidence interval around the median. We compute the confidence interval as median +/- 1.57 " IQR / sqrt(N), where IQR is the interquartile range and N is the sample size. If two boxes' notches do not overlap there is 95% confidence their medians differ. See https://sites.google.com/site/davidsstatistics/home/notched-box-plots for more info. Defaults to "false" unless `notchwidth` or `notchspan` is set.</param>
/// <param name="NotchWidth">Sets the width of the notches relative to the box' width. For example, with 0, the notches are as wide as the box(es).</param>
/// <param name="QuartileMethod">Sets the method used to compute the sample's Q1 and Q3 quartiles. The "linear" method uses the 25th percentile for Q1 and 75th percentile for Q3 as computed using method #10 (listed on http://www.amstat.org/publications/jse/v14n3/langford.html). The "exclusive" method uses the median to divide the ordered dataset into two halves if the sample is odd, it does not include the median in either half - Q1 is then the median of the lower half and Q3 the median of the upper half. The "inclusive" method also uses the median to divide the ordered dataset into two halves but if the sample is odd, it includes the median in both halves - Q1 is then the median of the lower half and Q3 the median of the upper half.</param>
/// <param name="SizeMode">Sets the upper and lower bound for the boxes quartiles means box is drawn between Q1 and Q3 SD means the box is drawn between Mean +- Standard Deviation Argument sdmultiple (default 1) to scale the box size So it could be drawn 1-stddev, 3-stddev etc</param>
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
[<Extension>]
static member BoxPlot
Expand Down Expand Up @@ -3950,6 +3954,7 @@ module Chart2D =
[<Optional; DefaultParameterValue(null)>] ?Notched: bool,
[<Optional; DefaultParameterValue(null)>] ?NotchWidth: float,
[<Optional; DefaultParameterValue(null)>] ?QuartileMethod: StyleParam.QuartileMethod,
[<Optional; DefaultParameterValue(null)>] ?SizeMode: StyleParam.BoxSizeMode,
[<Optional; DefaultParameterValue(true)>] ?UseDefaults: bool
) =

Expand All @@ -3976,6 +3981,7 @@ module Chart2D =
?Notched = Notched,
?NotchWidth = NotchWidth,
?QuartileMethod = QuartileMethod,
?SizeMode = SizeMode,
?UseDefaults = UseDefaults
)

Expand Down Expand Up @@ -4014,6 +4020,7 @@ module Chart2D =
/// <param name="Notched">Determines whether or not notches are drawn. Notches displays a confidence interval around the median. We compute the confidence interval as median +/- 1.57 " IQR / sqrt(N), where IQR is the interquartile range and N is the sample size. If two boxes' notches do not overlap there is 95% confidence their medians differ. See https://sites.google.com/site/davidsstatistics/home/notched-box-plots for more info. Defaults to "false" unless `notchwidth` or `notchspan` is set.</param>
/// <param name="NotchWidth">Sets the width of the notches relative to the box' width. For example, with 0, the notches are as wide as the box(es).</param>
/// <param name="QuartileMethod">Sets the method used to compute the sample's Q1 and Q3 quartiles. The "linear" method uses the 25th percentile for Q1 and 75th percentile for Q3 as computed using method #10 (listed on http://www.amstat.org/publications/jse/v14n3/langford.html). The "exclusive" method uses the median to divide the ordered dataset into two halves if the sample is odd, it does not include the median in either half - Q1 is then the median of the lower half and Q3 the median of the upper half. The "inclusive" method also uses the median to divide the ordered dataset into two halves but if the sample is odd, it includes the median in both halves - Q1 is then the median of the lower half and Q3 the median of the upper half.</param>
/// <param name="SizeMode">Sets the upper and lower bound for the boxes quartiles means box is drawn between Q1 and Q3 SD means the box is drawn between Mean +- Standard Deviation Argument sdmultiple (default 1) to scale the box size So it could be drawn 1-stddev, 3-stddev etc</param>
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
[<Extension>]
static member BoxPlot
Expand Down Expand Up @@ -4041,6 +4048,7 @@ module Chart2D =
[<Optional; DefaultParameterValue(null)>] ?Notched: bool,
[<Optional; DefaultParameterValue(null)>] ?NotchWidth: float,
[<Optional; DefaultParameterValue(null)>] ?QuartileMethod: StyleParam.QuartileMethod,
[<Optional; DefaultParameterValue(null)>] ?SizeMode: StyleParam.BoxSizeMode,
[<Optional; DefaultParameterValue(true)>] ?UseDefaults: bool
) =

Expand Down Expand Up @@ -4071,6 +4079,7 @@ module Chart2D =
?Notched = Notched,
?NotchWidth = NotchWidth,
?QuartileMethod = QuartileMethod,
?SizeMode = SizeMode,
?UseDefaults = UseDefaults
)

Expand Down
17 changes: 17 additions & 0 deletions src/Plotly.NET/CommonAbstractions/StyleParams.fs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,23 @@ module StyleParam =

member this.Convert() = this |> BoxPoints.convert

/// <summary>
/// Sets the upper and lower bound for the boxes quartiles means box is drawn between Q1 and Q3 SD means the box is drawn between Mean +- Standard Deviation
/// </summary>
[<RequireQualifiedAccess>]
type BoxSizeMode =
| Quartiles
| SD

static member toString =
function
| Quartiles -> "quartiles"
| SD -> "sd"

static member convert = BoxSizeMode.toString >> box
override this.ToString() = this |> BoxSizeMode.toString
member this.Convert() = this |> BoxSizeMode.convert



[<RequireQualifiedAccess>]
Expand Down
Loading

0 comments on commit d1c63b9

Please sign in to comment.