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

fix misplaced xlabel setting #95

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading