Skip to content

Commit

Permalink
fix misplaced xlabel setting
Browse files Browse the repository at this point in the history
  • Loading branch information
palday committed May 14, 2024
1 parent 76f56c3 commit eca62ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 4 additions & 5 deletions src/coefplot.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
coefplot(x::Union{MixedModel,MixedModelBootstrap}; kwargs...)::Figure
coefplot!(fig::$(Indexable), x::Union{MixedModel,MixedModelBootstrap};
coefplot!(fig::$(Indexable), x::Union{MixedModel,MixedModelBootstrap};
kwargs...)
coefplot!(ax::Axis, Union{MixedModel,MixedModelBootstrap};
conf_level=0.95, vline_at_zero=true, show_intercept=true, attributes...)
Expand All @@ -13,8 +13,8 @@ Inestimable coefficients (coefficients removed by pivoting in the rank deficient
The mutating methods return the original object.
!!! note
Inestimable coefficients (coefficients removed by pivoting in the rank deficient case)
!!! note
Inestimable coefficients (coefficients removed by pivoting in the rank deficient case)
are excluded.
"""
function coefplot(x::Union{MixedModel,MixedModelBootstrap}; show_intercept=true, kwargs...)
Expand Down Expand Up @@ -42,8 +42,7 @@ function coefplot!(ax::Axis, x::Union{MixedModel,MixedModelBootstrap};
xvals = ci.estimate
xlabel = @sprintf "Estimate and %g%% confidence interval" conf_level * 100

attributes = merge((; xlabel), attributes)
ax.xlabel = attributes.xlabel
ax.xlabel = xlabel

scatter!(ax, xvals, y; attributes...)
errorbars!(ax, xvals, y, xvals .- ci.lower, ci.upper .- xvals;
Expand Down
12 changes: 6 additions & 6 deletions src/ridge.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
ridgeplot(x::Union{MixedModel,MixedModelBootstrap}; kwargs...)::Figure
ridgeplot!(fig::$(Indexable), x::Union{MixedModel,MixedModelBootstrap};
ridgeplot!(fig::$(Indexable), x::Union{MixedModel,MixedModelBootstrap};
kwargs...)
ridgeplot!(ax::Axis, Union{MixedModel,MixedModelBootstrap};
conf_level=0.95, vline_at_zero=true, show_intercept=true, attributes...)
Expand All @@ -16,8 +16,8 @@ Setting `conf_level=missing` removes the markings for the highest density interv
The mutating methods return the original object.
!!! note
Inestimable coefficients (coefficients removed by pivoting in the rank deficient case)
!!! note
Inestimable coefficients (coefficients removed by pivoting in the rank deficient case)
are excluded.
"""
function ridgeplot(x::MixedModelBootstrap; show_intercept=true, kwargs...)
Expand All @@ -36,7 +36,7 @@ end
"""
_color(s::Symbol)
_color(p::Pair)
Extract the color part out of either a color name or a `(color, alpha)` pair.
"""
_color(s) = s
Expand All @@ -60,10 +60,10 @@ function ridgeplot!(ax::Axis, x::MixedModelBootstrap;
attributes...)
end

attributes = merge((; xlabel, color=:black), attributes)
attributes = merge((; color=:black), attributes)
band_attributes = merge(attributes, (; color=(_color(attributes.color), 0.3)))

ax.xlabel = attributes.xlabel
ax.xlabel = xlabel

df = transform!(DataFrame(x.β), :coefname => ByRow(string) => :coefname)
filter!(:coefname => in(_coefnames(x; show_intercept)), df)
Expand Down

0 comments on commit eca62ae

Please sign in to comment.