Skip to content

Commit

Permalink
add feature to change x-axis order for boxplots (#483)
Browse files Browse the repository at this point in the history
* add feature to change x-axis order for boxplots

* change name of new parameter to order_labels_by

* fix typo

* correctly formatted new changes

* Update src/boxplot.jl

---------

Co-authored-by: Seth Axen <seth@sethaxen.com>
Co-authored-by: Seth Axen <seth.axen@gmail.com>
  • Loading branch information
3 people committed Jul 17, 2023
1 parent 90b5f4f commit 338740e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/boxplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ notch_width(q2, q4, N) = 1.58 * (q4 - q2) / sqrt(N)
whisker_range = 1.5,
outliers = true,
whisker_width = :half,
sort_labels_by = identity,
xshift = 0.0,
)
# if only y is provided, then x will be UnitRange 1:size(y,2)
Expand All @@ -32,7 +33,7 @@ notch_width(q2, q4, N) = 1.58 * (q4 - q2) / sqrt(N)
isnothing(bw) && (bw = 0.8)
@assert whisker_width === :match || whisker_width == :half || whisker_width >= 0 "whisker_width must be :match, :half, or a positive number"
ww = whisker_width === :match ? bw : whisker_width == :half ? bw / 2 : whisker_width
for (i, glabel) in enumerate(glabels)
for (i, glabel) in enumerate(sort(glabels; by = sort_labels_by))
# filter y
values = y[filter(i -> _cycle(x, i) == glabel, 1:length(y))]

Expand Down

0 comments on commit 338740e

Please sign in to comment.