Skip to content

Commit cc196b8

Browse files
committed
handle title separately
1 parent a718060 commit cc196b8

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/coefplot.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ end
3434
"""$(@doc coefplot)"""
3535
function coefplot!(fig::Indexable, x::Union{MixedModel,MixedModelBootstrap}; kwargs...)
3636
ax = Axis(fig[1, 1])
37+
kwargs = _extract_title!(ax, kwargs)
3738
coefplot!(ax, x; kwargs...)
3839
return fig
3940
end
@@ -65,3 +66,12 @@ function coefplot!(ax::Axis, x::Union{MixedModel,MixedModelBootstrap};
6566
ylims!(ax, 0, nticks + 1)
6667
return ax
6768
end
69+
70+
# function g(; kwargs...)
71+
# if :a in keys(kwargs)
72+
# a = kwargs[:a]
73+
# kwargs = Base.pairs(NamedTuple((k => v for (k, v) in kwargs if k != :a)))
74+
# end
75+
76+
# @info "" kwargs
77+
# end

src/ridge.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function ridgeplot!(ax::Axis, x::MixedModelBootstrap;
7575
scatter_attributes, errorbars_attributes, attributes...)
7676
end
7777

78+
attributes = _extract_title!(ax, attributes)
7879
attributes = merge((; color=:black), attributes)
7980
band_attributes = merge((; color=(_color(attributes.color), 0.3)), band_attributes)
8081

src/utilities.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,21 @@ function confint_table(x::MixedModelBootstrap, level=0.95; show_intercept=true)
5555
return filter!(:coefname => in(_coefnames(x; show_intercept)), df)
5656
end
5757

58+
"""
59+
_extract_title!(ax::Axis, kwargs)::Base.Pairs
60+
61+
If a title is present in kwargs, use it to set the axis title.
62+
63+
Returns kwargs without an entry for `title`.
64+
"""
65+
function _extract_title!(ax::Axis, kwargs)::Base.Pairs
66+
if :title in keys(kwargs)
67+
ax.title = kwargs[:title]
68+
kwargs = NamedTuple((k => v for (k, v) in kwargs if k != :title))
69+
end
70+
return Base.pairs(kwargs)
71+
end
72+
5873
_npreds(x; show_intercept=true) = length(_coefnames(x; show_intercept))
5974

6075
"""

0 commit comments

Comments
 (0)