Skip to content

Commit

Permalink
Don't force triangle mesh in crossbar with notch to avoid CairoMakie …
Browse files Browse the repository at this point in the history
…artifacts (#4587)

* Don't force triangle mesh in crossbar with notch to avoid CairoMakie artifacts

* add changelog

* use half transparent color in test to guard against mesh seams coming back
  • Loading branch information
jkrumbiegel authored Nov 12, 2024
1 parent d3147ab commit d7d407e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- Fix polygon rendering issue of `crossbar(..., show_notch = true)` in CairoMakie [#4587](https://github.com/MakieOrg/Makie.jl/pull/4587).

## [0.21.16] - 2024-11-06

Expand Down
2 changes: 1 addition & 1 deletion ReferenceTests/src/tests/examples2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ end
show_notch = true, notchwidth = 0.3,
notchmin = ys .- (0.05:0.05:0.3), notchmax = ys .+ (0.3:-0.05:0.05),
strokewidth = 2, strokecolor = :black,
orientation = :horizontal, color = :lightblue
orientation = :horizontal, color = (:gray, 0.5)
)
fig
end
Expand Down
7 changes: 1 addition & 6 deletions src/stats/crossbar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Makie.plot!(plot::CrossBar)
end
# when notchmin = ymin || notchmax == ymax, fill disappears from
# half the box. first ∘ StatsBase.rle removes adjacent duplicates.
points = first.(StatsBase.rle.(Base.vect.(fpoint.(l, ymin),
boxes = first.(StatsBase.rle.(Base.vect.(fpoint.(l, ymin),
fpoint.(r, ymin),
fpoint.(r, nmin),
fpoint.(m .+ nw .* hw, y), # notch right
Expand All @@ -89,11 +89,6 @@ function Makie.plot!(plot::CrossBar)
fpoint.(l, nmin),
fpoint.(l, ymin)
)))
boxes = if points isa AbstractVector{<: Point} # poly
[GeometryBasics.triangle_mesh(points)]
else # multiple polys (Vector{Vector{<:Point}})
GeometryBasics.triangle_mesh.(points)
end
midlines = Pair.(fpoint.(m .- nw .* hw, y), fpoint.(m .+ nw .* hw, y))
else
boxes = frect.(l, ymin, boxwidth, ymax .- ymin)
Expand Down

0 comments on commit d7d407e

Please sign in to comment.