Skip to content

Commit

Permalink
Fix aesthetics of errorbars (#560)
Browse files Browse the repository at this point in the history
Got this wrong, the first two args are always x/y and the `direction =
:x` attribute just flips the error direction from there, unlike
`rangebars`.
  • Loading branch information
jkrumbiegel committed Sep 16, 2024
1 parent e63bba3 commit 7e316ba
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 13 deletions.
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

- Fixed aesthetics of `errorbar` so that x and y stay labelled correctly when using `direction = :x` [#560](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/560).
- Added ability to specify `title`, `subtitle` and `footnotes` plus settings in the `draw` function [#556](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/556).

## v0.8.7 - 2024-09-06
Expand Down
10 changes: 2 additions & 8 deletions src/aesthetics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,8 @@ function aesthetic_mapping(::Type{Errorbars}, i::Int)
])
]
dictionary([
1 => :direction => dictionary([
:x => AesY,
:y => AesX,
]),
2 => :direction => dictionary([
:x => AesX,
:y => AesY,
]),
1 => AesX,
2 => AesY,
3 => :direction => dictionary([
:x => AesDeltaX,
:y => AesDeltaY,
Expand Down
10 changes: 5 additions & 5 deletions test/reference_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,27 +196,27 @@ reftest("rangebars cat color direction x") do
end

reftest("errorbars") do
data((; x = 1:4, y = 1:4, err = 2:5)) * mapping(:x, :y, :err) *
data((; x = ["A", "B", "C", "D"], y = 5:8, err = 2:5)) * mapping(:x, :y, :err) *
visual(Errorbars) |> draw
end

reftest("errorbars direction x") do
data((; x = 1:4, y = 1:4, err = 2:5)) * mapping(:x, :y, :err) *
data((; x = ["A", "B", "C", "D"], y = 5:8, err = 2:5)) * mapping(:x, :y, :err) *
visual(Errorbars; direction = :x) |> draw
end

reftest("errorbars cat color direction x") do
data((; x = 1:4, y = 1:4, err = 2:5, z = 1:4)) * mapping(:x, :y, :err, color = :z => nonnumeric) *
data((; x = ["A", "B", "C", "D"], y = 5:8, err = 2:5, z = 1:4)) * mapping(:x, :y, :err, color = :z => nonnumeric) *
visual(Errorbars; direction = :x) |> draw
end

reftest("errorbars cat color") do
data((; x = 1:4, y = 1:4, err = 2:5, z = 1:4)) * mapping(:x, :y, :err, color = :z => nonnumeric) *
data((; x = ["A", "B", "C", "D"], y = 5:8, err = 2:5, z = 1:4)) * mapping(:x, :y, :err, color = :z => nonnumeric) *
visual(Errorbars) |> draw
end

reftest("errorbars low high") do
data((; x = 1:4, y = 1:4, errlow = [0.1, 0.2, 0.3, 0.4], errhigh = [0.4, 0.2, 0.3, 0.1])) * mapping(:x, :y, :errlow, :errhigh) *
data((; x = ["A", "B", "C", "D"], y = 5:8, errlow = [0.1, 0.2, 0.3, 0.4], errhigh = [0.4, 0.2, 0.3, 0.1])) * mapping(:x, :y, :errlow, :errhigh) *
visual(Errorbars) |> draw
end

Expand Down
Binary file modified test/reference_tests/errorbars cat color direction x ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/reference_tests/errorbars cat color ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/reference_tests/errorbars direction x ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/reference_tests/errorbars low high ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/reference_tests/errorbars ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7e316ba

Please sign in to comment.