-
Notifications
You must be signed in to change notification settings - Fork 2.1k
position_stack() should stack +ive & -ve values separately #1691
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
Comments
There are a lot of case where, even if supported, negative values doesn't make sense when stacking. As I see it it only makes sense for stacked bar charts - can you come with other examples... I'm asking because I need to know which types of checks to make and warnings to throw, and also where it should be solved. It could be handled directly by |
…ed separately to allow stacking below the x-axis
Can you come with an example where stacking makes sense apart from bars/areas? I think that's the only case we need to worry about, and it's reasonable for positive values to stack upwards from the y-axis, and negative values to stack downwards. Your fix seems reasonable to me - I don't think there's any way to have an elegant solution without completely rewriting the stacking (which we don't want to do) |
I cannot - which was why I asked whether you knew of any other use cases. I'll move forward with #1693 |
I think we can also stack dots which can be useful in some cases. http://www.lispworks.com/success-stories/inspiredata.html |
@smouksassi true. Dot plots should mainly be used for count data though, which makes them unsuitable to show negative values. |
I was thinking about a kind of back to back dotplot like this: https://nzmaths.co.nz/resource/fully-stretched: |
Dot plots have to use a completely different algorithm so aren't relevant to this discussion. |
Here's an example where the current behavior of position_stack for a mixture of positive and negative values produced the desired result: the total extent of the bar aligns with the sum of the values (please ignore the politics, just examples that I happened to have handy). In another example, I wanted to show what was happening on the negative side with a dodge: |
I do think that these examples, while potentially useful to you, violates the general expectations of stacking, namely that stacks are build from the ground and up (or down), that is, they extend from zero |
Cool plots, and it is a nice use, but I think it also violates the principle that you expect |
Fixes tidyverse#1691. Positive and negative y-values are now calculated separately to allow stacking below the x-axis Fix for geom_area geom_area doesn’t sort ymin and ymax so this needs to be handled here for correct results Add docs Adding documentation to position_stack Unit tests for the bug fixes/features Add bullets to news
The text was updated successfully, but these errors were encountered: