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

Waterfall recipe #2416

Merged
merged 6 commits into from Dec 2, 2022
Merged

Waterfall recipe #2416

merged 6 commits into from Dec 2, 2022

Conversation

daschw
Copy link
Contributor

@daschw daschw commented Nov 13, 2022

Description

This is the implementation of waterfall charts as a recipe as discussed with @jkrumbiegel in #2314.
Not sure, if the amount and naming of specific attributes is OK;
It adds the following examples to the docs:

using Makie

y = [6, 4, 2, -8, 3, 5, 1, -2, -3, 7]

waterfall(y)

example_10448004870160825484

waterfall(y, show_direction=true)

example_13954012298839594358

waterfall(y, show_direction=true, marker_pos=:cross, marker_neg=:hline, direction_color=:gold)

example_17457802745984131740

x = repeat(1:2, inner=5)
group = repeat(1:5, outer=2)
colors = Makie.wong_colors()

waterfall(x, y, dodge=group, color=colors[group])

example_6936188115957499170

waterfall(x, y, dodge=group, color=colors[group], show_direction=true, show_final=true)

example_13365502442967251696

waterfall(x, y, dodge=group, color=colors[group], show_final=true, final_color=(colors[6], 1//3))

example_5313543370909876466

waterfall(group, y, dodge=x, color=colors[x], stack=:x, show_direction=true)

example_16283516057630021035

Type of change

Delete options that do not apply:

  • New feature (non-breaking change which adds functionality)

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.

final_gap = p.final_gap[] === automatic ? p.dodge[] == automatic ? 0 : p.gap : p.final_gap
barplot!(
p,
fromto[].final;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should turn all the fromto[]/marker[]/etc into: lift(x-> x.xy, fromto)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hint! Does this also apply to p.show_final[], p.final_gap[] etc?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but there you should be able to just remove the []

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, but if I remove [] e.g. in L58, I get

ERROR: TypeError: non-boolean (Observable{Any}) used in boolean context

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah only remove it when passing it to another plotting function, not actually when using it in an if ;) It's still an observable after all, and not a boolean

@daschw
Copy link
Contributor Author

daschw commented Nov 29, 2022

bump: I added more lifts in the recipe as suggested by Simon. Is there anything else I should change to move this forward?

@SimonDanisch SimonDanisch merged commit 1c8d098 into MakieOrg:master Dec 2, 2022
t-bltg pushed a commit to t-bltg/Makie.jl that referenced this pull request Dec 31, 2022
* implement waterfall recipe

* add plotting_functions examples for waterfall to the docs

* mention waterfall in NEWS.md

* add more `lift`s in waterfall recipe

Co-authored-by: Simon <sdanisch@protonmail.com>
@daschw daschw deleted the waterfall-recipe branch November 9, 2023 14:20
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.

None yet

3 participants