Skip to content

Commit

Permalink
Stairs (#573)
Browse files Browse the repository at this point in the history
- **add aesthetics for Stairs**
- **add legend implementation**
- **add reference test**
- **bump patch version**
- **add changelog entry**
  • Loading branch information
jkrumbiegel authored Oct 21, 2024
1 parent 448d330 commit 320419e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## v0.8.13 - 2024-10-21

- Added aesthetics for `Stairs` [#573](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/573).

## v0.8.12 - 2024-10-07

- Added `legend` keyword in `visual` to allow overriding legend element attributes [#570](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/570).
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AlgebraOfGraphics"
uuid = "cbdf2221-f076-402e-a563-3d30da359d67"
authors = ["Pietro Vertechi", "Julius Krumbiegel"]
version = "0.8.12"
version = "0.8.13"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
11 changes: 11 additions & 0 deletions src/aesthetics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,14 @@ function aesthetic_mapping(::Type{Hist}, ::Normal)
:strokecolor => AesColor,
])
end

aesthetic_mapping(::Type{Stairs}, ::Normal) = aesthetic_mapping(Stairs, 1)
aesthetic_mapping(::Type{Stairs}, ::Normal, ::Normal) = aesthetic_mapping(Stairs, 2)

function aesthetic_mapping(::Type{Stairs}, N::Int)
dictionary([
pointlike_positionals(N)...,
:color => AesColor,
:linestyle => AesLineStyle,
])
end
2 changes: 1 addition & 1 deletion src/guides/legend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ function legend_elements(T::Type{Heatmap}, attributes, scale_args::MixedArgument
)]
end

function legend_elements(T::Type{<:Union{HLines,VLines,Lines,LineSegments,Errorbars,Rangebars,Wireframe,ABLines,ECDFPlot}}, attributes, scale_args::MixedArguments)
function legend_elements(T::Type{<:Union{HLines,VLines,Lines,LineSegments,Errorbars,Rangebars,Wireframe,ABLines,ECDFPlot,Stairs}}, attributes, scale_args::MixedArguments)

is_vertical = T === VLines || (T <: Union{Errorbars,Rangebars} && _get(T, scale_args, attributes, :direction) === :y)
# TODO: seems errorbars and rangebars are missing linestyle in Makie, once this is fixed, remove this
Expand Down
11 changes: 11 additions & 0 deletions test/reference_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1007,3 +1007,14 @@ reftest("legend element overrides") do
visual(Scatter, legend = (; markersize = 30))
draw(spec)
end

reftest("stairs") do
spec = mapping(
1:10,
[1, 4, 3, 7, 5, 3, 2, 4, 3, 7],
color = repeat(["A", "B"], inner = 5),
linestyle = repeat(["A", "B"], inner = 5),
) *
visual(Stairs)
draw(spec)
end
Binary file added test/reference_tests/stairs ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

2 comments on commit 320419e

@jkrumbiegel
Copy link
Member Author

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/117760

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.8.13 -m "<description of version>" 320419ea50a1efb14cf10d5c95bf57b57dc2b0d3
git push origin v0.8.13

Please sign in to comment.