Skip to content

Commit

Permalink
add axislegend method that inputs an axis and a title (#3808)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarthur authored May 1, 2024
1 parent 2a2a271 commit 714cf7a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- Add `axislegend(ax, "title")` method [#3808](https://github.com/MakieOrg/Makie.jl/pull/3808)
- Improved thread safety of rendering with CairoMakie (independent `Scene`s only) by locking FreeType handles [#3777](https://github.com/MakieOrg/Makie.jl/pull/3777).

## [0.20.9] - 2024-03-29
Expand Down
4 changes: 3 additions & 1 deletion src/makielayout/blocks/legend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,14 @@ end
axislegend(ax = current_axis(); kwargs...) = axislegend(ax, ax; kwargs...)

axislegend(title::AbstractString; kwargs...) = axislegend(current_axis(), current_axis(), title; kwargs...)
axislegend(ax, title::AbstractString; kwargs...) = axislegend(ax, ax, title; kwargs...)

"""
axislegend(ax, args...; position = :rt, kwargs...)
axislegend(ax, args...; position = (1, 1), kwargs...)
axislegend(ax = current_axis(); kwargs...)
axislegend(title::AbstractString; kwargs...)
axislegend(ax, title::AbstractString; kwargs...)
Create a legend that sits inside an Axis's plot area.
Expand Down Expand Up @@ -836,4 +838,4 @@ function attribute_examples(::Type{Legend})
),
],
)
end
end
1 change: 1 addition & 0 deletions test/makielayout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ end
leg = axislegend(ax, position = (0.4, 0.8))
@test leg.halign[] == 0.4
@test leg.valign[] == 0.8
@test_nowarn axislegend(ax, "foo") # issue 2530
end

# issue 2005
Expand Down

0 comments on commit 714cf7a

Please sign in to comment.