Skip to content

Commit 32f23a5

Browse files
authored
Fix 4-element pair mapping (#596)
- **Fix `mapping` with 4-element pair** - **add changelog** - **bump patch version**
1 parent 636d518 commit 32f23a5

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.9.2 - 2025-02-03
4+
5+
- Fixed `data(...) * mapping(col => func => label => scale)` label-extraction bug [#596](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/596).
6+
37
## v0.9.1 - 2025-01-31
48

59
- Fixed passing `axis` keyword to `draw(::Pagination, ...)` [#595](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/595).

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AlgebraOfGraphics"
22
uuid = "cbdf2221-f076-402e-a563-3d30da359d67"
33
authors = ["Pietro Vertechi", "Julius Krumbiegel"]
4-
version = "0.9.1"
4+
version = "0.9.2"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

src/algebra/select.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ function select(data, x::Pair{<:Any, <:Pair{<:Any, ScaleID}})
100100
return vs => transf => label => x[2][2]
101101
end
102102

103+
function select(data, x::Pair{<:Any, <:Pair{<:Any, <:Pair{<:Any, ScaleID}}})
104+
(col, (f, (lbl, id))) = x
105+
(vs, (transf, (label, _))) = select(data, col => f => lbl)
106+
return vs => transf => label => id
107+
end
108+
103109
function select(data, x::Pair{<:Any, ScaleID})
104110
(vs, (transf, (label, _))) = select(data, x[1])
105111
return vs => transf => label => x[2]

test/algebra.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ end
4141
@test processedlayer.primary[:color] == fill(["x", "x", "x"])
4242
@test processedlayer.scale_mapping[:color] == :otherscale
4343

44+
layer = data(df) * mapping(:x => sqrt => "sqrt(X)" => scale(:X2))
45+
processedlayer = AlgebraOfGraphics.process_mappings(layer)
46+
@test processedlayer.positional[1] == fill(sqrt.(df.x))
47+
@test processedlayer.labels[1] == fill("sqrt(X)")
48+
@test processedlayer.scale_mapping[1] == :X2
49+
4450
layer = data(df) * mapping(:x, direct(1:1000) => "y")
4551
processedlayer = AlgebraOfGraphics.process_mappings(layer)
4652
@test processedlayer.positional[2] == fill(1:1000)

0 commit comments

Comments
 (0)