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

text gets positioned off when coord_flip() #5

Open
CerebralMastication opened this issue Dec 10, 2018 · 2 comments
Open

text gets positioned off when coord_flip() #5

CerebralMastication opened this issue Dec 10, 2018 · 2 comments

Comments

@CerebralMastication
Copy link
Collaborator

I'm loving your waterfalls package and am so glad I don't have to build these up from scratch! Thank you so much for making this available.

I've run into an interesting edge scenario, however. I like to flip my waterfalls around using coord_flip() in ggplot2. But when I do, the text labels get bumped around.

For example:

waterfall(
  tibble(category = letters[1:5],
         value = c(200, -20, 4, 20, -5)),
  calc_total = TRUE,
  fill_by_sign = FALSE,
  put_rect_text_outside_when_value_below = 50
) + coord_flip() 

image

I'm beginning to dig into the code and if I cook up a solution I'll send a PR. But I wanted to register the issue first.

@HughParsonage
Copy link
Owner

Thank you for the report!

A PR would be welcome. I've given you push access to the repository -- feel free to push a branch or fork and add a PR as you wish. Let me know if you don't make progress and I'll try to fix.

@CerebralMastication
Copy link
Collaborator Author

Thanks Hugh.

I’m thinking about adding a ‘coord_flip’ parameter. Then in code I can address the labels as well as the bar order.

The labels just need to be moved further out when flipped, I think. But the distance is a function of how big the label is. Meh. Tricky.

For the bar order, I’ll try to just flip the factors around at the start of the

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

No branches or pull requests

2 participants