Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

violin error #4675

Open
goulf-3m opened this issue Dec 17, 2024 · 1 comment · May be fixed by #4682
Open

violin error #4675

goulf-3m opened this issue Dec 17, 2024 · 1 comment · May be fixed by #4682
Labels
bug Makie Backend independent issues (Makie core)

Comments

@goulf-3m
Copy link

Makie 0.21.17

This command will fail:

GLMakie.violin(fill(1, 1000), push!(fill(0, 999), 1), show_median=true, datalimits=(-0.001,Inf))
@goulf-3m goulf-3m added the bug label Dec 17, 2024
@ffreyer
Copy link
Collaborator

ffreyer commented Dec 17, 2024

With ERROR: BoundsError: attempt to access 194-element view(::Vector{Float64}, 7:200) with eltype Float64 at index [0] due to the ip-1 here:

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]
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)
push!(lines, median_left => median_right)
end

@ffreyer ffreyer added the Makie Backend independent issues (Makie core) label Dec 17, 2024
@ffreyer ffreyer linked a pull request Dec 18, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Makie Backend independent issues (Makie core)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants