You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then you get event labels on the x axis for free. But, what's to be done about starting and end balances?
I think it could go like this:
log_of_events_and_flow_amount_df |>
ggplot() +
aes(x = event, flow = flow) +
geom_waterfall(start_balance = 200) + # pure waterfall that starts at 200
geom_waterfall_balances(start_ballance = 200) # adds bars straddling the pure waterfall - two new x positions created
Where start balance takes x position 0, and end balance takes x position max(event) + 1, and we don't get x axis label. And I think this will error because of the new x positions that don't correspond to x inputs.
I think if the required aes for geom_waterfall_balances is 'event' the error can be circumvented.
log_of_events_and_flow_amount_df |>
ggplot() +
aes(x = event, flow = flow) +
geom_waterfall(start_balance = 200) + # pure waterfall that starts at 200
aes(event = event_var) +
geom_waterfall_balances(start_ballance = 200) # adds bars straddling the pure waterfall - two new x positions created
Then you could wrap up waterfall and waterfall_balances into something like geom_waterfall_flanked:
log_of_events_and_flow_amount_df |>
ggplot() +
aes(x = event, event = event, flow = flow) + # inputing event twice feels not so great, but it's relatively concise I guess
geom_waterfall_flanked(start_balance = 200)
No x axis labels at x = 0 and max(event) + 1 but may be worth trying out.
A scale that looks at the existing scale and modifies based on that would be nice. Really spitballing/dreamland stuff I think here.
last_plot() +
scale_x_discrete_addcats(cats_before = "start balance", cats_after = "end balance",
cat_insert = "my special event", cat_at = 3)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
What to do about discrete scales markers that that don't come from the data is still something I think about all the time because of ggwaterfall.
The 'pure' waterfall probably only represents flows:
Then you get event labels on the x axis for free. But, what's to be done about starting and end balances?
I think it could go like this:
Where start balance takes x position 0, and end balance takes x position max(event) + 1, and we don't get x axis label. And I think this will error because of the new x positions that don't correspond to x inputs.
I think if the required aes for geom_waterfall_balances is 'event' the error can be circumvented.
Then you could wrap up waterfall and waterfall_balances into something like geom_waterfall_flanked:
No x axis labels at x = 0 and max(event) + 1 but may be worth trying out.
A scale that looks at the existing scale and modifies based on that would be nice. Really spitballing/dreamland stuff I think here.
Beta Was this translation helpful? Give feedback.
All reactions