JuliaPsychometrics/ItemResponsePlots.jl

Hatched confidence intervals

Opened this issue · 0 comments

p-gw commented

Try how patterned confidence intervals look based on Makie.LinePattern:

col = "#f43f5e"

pat = Makie.LinePattern(;
    direction = Vec2f(1, -1),
    width = 0.5,
    tilesize = (4, 4),
    linecolor = col,
    background_color = :transparent,
)

x = range(-3, 3, 200)

lower = Point2f.(x, irf.(OnePL, x, Ref((; b = -0.25)), 1))
mid = Point2f.(x, irf.(OnePL, x, Ref((; b = 0.0)), 1))
upper = Point2f.(x, irf.(OnePL, x, Ref((; b = 0.25)), 1))

polygon = [lower..., upper[end:-1:1]..., lower[1]]

fig = Figure()
ax = Axis(fig[1, 1])

hlines!(ax, [0, 1], color = "#d4d4d4")
poly!(ax, polygon, color = pat)
lines!(ax, mid, color = col, linewidth = 1)
xlims!(ax, -3, 3)

fig

fig