Skip to content

Commit

Permalink
fix misplaced xlabel setting (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
palday authored May 14, 2024
1 parent 76f56c3 commit 0ec7767
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

2 comments on commit 0ec7767

@palday
Copy link
Owner Author

@palday palday commented on 0ec7767 May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/106735

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.1 -m "<description of version>" 0ec7767d58bb36ebf1ae909572e6d2f24a23b640
git push origin v0.4.1

Please sign in to comment.