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

Feature request: Could scales::number etc have a style_negative option of "none"? #443

Closed
davidhodge931 opened this issue Jul 11, 2024 · 4 comments

Comments

@davidhodge931
Copy link

"none" is useful option for population pyramids, where you hack the data by multiplying the Female population

This should also flow into all of the label_*() functions.

So the argument would look like...

number(
  ...,
  style_negative = c("hyphen", "minus", "parens", "none"),

and the help would have an extra bullet...

  • "none" removes any negative styling.

Could be something for Tidy Dev Day?

@davidhodge931 davidhodge931 changed the title Could scales::number etc have a sytle_negative option of "none"? Could scales::number etc have a style_negative option of "none"? Jul 20, 2024
@davidhodge931 davidhodge931 changed the title Could scales::number etc have a style_negative option of "none"? Feature request: Could scales::number etc have a style_negative option of "none"? Jul 21, 2024
@davidhodge931 davidhodge931 changed the title Feature request: Could scales::number etc have a style_negative option of "none"? Feature request: Could scales::number etc have a style_negative option of "none"? Jul 21, 2024
@davidsirl
Copy link

davidsirl commented Oct 4, 2024

My experience is that this is possible with a slightly different approach to that suggested:

scale_x_continuous(breaks = pop_breaks, labels = abs(pop_breaks)),

where pop_breaks is organised beforehand as values_plotted |> abs() |> max() and then using base::pretty() to make the breakpoints nice round numbers.

(https://www.njtierney.com/post/2022/08/09/ggplot-pyramid/ was my source for that)

One can "tidy up" such labels further by using comma() but (i) comma() is superseded and (ii) I do not see how to do the same sort of thing with the superseding function label_comma().

(Hope that's constructive - first time issue-commenter :) )

@teunbrand
Copy link
Contributor

I'm sorry David but I genuinely think this is not a good idea, but I get why it might be useful.
Overall, omitting a minus indication is misleading and we want to make it harder to put up misleading labels, not easier.
I get this then requires some extra effort to label pyramid plots, but this is a specialised plot and the creator should just take some care to abs() their values before labelling.

@davidhodge931
Copy link
Author

Cool, thanks @teunbrand

@davidhodge931 davidhodge931 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
@davidsirl
Copy link

davidsirl commented Oct 30, 2024

I'm not sure I agree @teunbrand. Any plot can easily be made misleading and, like most plot options, this sort of functionality would aid informative labelling in some situations too. But if that's the decision then fair enough and thank you for explaining it and for linking to something that achieves the same thing.

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

3 participants