Skip to content

Commit

Permalink
Merge branch 'ff/render_pipeline_master' of https://github.com/MakieO…
Browse files Browse the repository at this point in the history
…rg/Makie.jl into ff/render_pipeline_master
  • Loading branch information
ffreyer committed Jan 3, 2025
2 parents 38e925c + 2fc970a commit d9019d0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

- Refactored rendering in GLMakie to go through a series of steps abstracted by a render pipeline. This allows rendering to be adjusted from outside and should simplify introducing more post-processing options in the future. [#4689](https://github.com/MakieOrg/Makie.jl/pull/4689)
- Fixed indexing error edge case in violin median code [#4682](https://github.com/MakieOrg/Makie.jl/pull/4682)

## [0.22.0] - 2024-12-12

Expand Down
6 changes: 3 additions & 3 deletions src/stats/violin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ function plot!(plot::Violin)
if show_median
# interpolate median bounds between corresponding points
xm = spec.median
ip = findfirst(>(xm), spec.kde.x)
ym₋, ym₊ = spec.kde.density[ip-1], spec.kde.density[ip]
xm₋, xm₊ = spec.kde.x[ip-1], spec.kde.x[ip]
ip = Base.max(2, something(findfirst(>(xm), spec.kde.x), length(spec.kde.x)))
ym₋, ym₊ = spec.kde.density[Base.max(1, ip-1)], spec.kde.density[ip]
xm₋, xm₊ = spec.kde.x[Base.max(1, ip-1)], spec.kde.x[ip]
ym = (xm * (ym₊ - ym₋) + xm₊ * ym₋ - xm₋ * ym₊) / (xm₊ - xm₋)
median_left = point_func(spec.side == 1 ? spec.x : spec.x - ym * scale, xm)
median_right = point_func(spec.side == -1 ? spec.x : spec.x + ym * scale, xm)
Expand Down
6 changes: 6 additions & 0 deletions test/statistical_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,10 @@ end
@test p2.plots[2] isa LineSegments
@test p2.plots[2][:color][] === :white
@test p2.plots[2][:visible][] === :false

# median edge case #4675
@test violin(fill(1, 1000), push!(fill(0, 999), 1), show_median=true, datalimits=(-0.001,Inf)) !== nothing
# And some others
@test violin(fill(1, 1000),fill(0, 1000), show_median=true) !== nothing
@test violin([1], [1], show_median=true) !== nothing
end

0 comments on commit d9019d0

Please sign in to comment.