Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve direction markers in waterfall recipe #3361

Merged
merged 2 commits into from
Jan 2, 2024

Conversation

daschw
Copy link
Contributor

@daschw daschw commented Nov 9, 2023

Description

Firstly this avoids showing direction markers in the waterfall recipe when no bars are visible:

using AlgebraOfGraphics
using CairoMakie

df = (
    x=repeat(1:2; inner=4),
    y=[1, 0, 0, 1, -1, 2, 2, 0],
    group=repeat('a':'d'; outer=2),
)

draw(
    data(df) *
    visual(Waterfall; show_direction=true, show_final=true, direction_color=:black) *
    mapping(:x, :y; color=:group, dodge=:group),
)

before the change:

waterfall_direction_old

after the change:

waterfall_direction_new

Secondly, it allows to pass different types to marker_pos and marker_neg in the waterfall recipe:

draw(
    data(df) *
    visual(Waterfall; show_direction=true, show_final=true, marker_pos='', direction_color=:black) *
    mapping(:x, :y; color=:group, dodge=:group),
)

before the change:

ERROR: MethodError: Cannot `convert` an object of type Symbol to an object of type Char

Closest candidates are:
  convert(::Type{T}, ::Number) where T<:AbstractChar
   @ Base char.jl:184
  convert(::Type{T}, ::T) where T<:AbstractChar
   @ Base char.jl:187
  convert(::Type{T}, ::AbstractChar) where T<:AbstractChar
   @ Base char.jl:186
  ...

after the change:

waterfall_direction_marker_new

Type of change

Delete options that do not apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • Added an entry in NEWS.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@jkrumbiegel jkrumbiegel merged commit 506c6ca into MakieOrg:master Jan 2, 2024
16 checks passed
@jkrumbiegel
Copy link
Member

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants