For a bar of zero height, if the line width is specified, we should be able to see the bar border, even though we don't see the bar.
In this example:
https://codepen.io/RichardNeill/pen/EJRqmN
B is a normal bar, with 10px border, as it should be.
C is a bar with height = null. It is, correctly, completely invisible.
But A is a bar with height = 0. It should actually appear as a 20px high rectangle (the border should still be displayed), even though the bar area itself isn't. Try setting the value to 0.0001
and you'll see what I expect. In addition, the hover tooltip is (wrongly) suppressed - it doesn't appear in "show closest data on hover" mode.
Thanks for writing in.
we should be able to see the bar border, even though we don't see the bar.
Can I ask _why_ that's the desired behavior in your use case?
This makes sense to me from a continuity standpoint - tiny positive and tiny negative look identical, but in between at exactly zero there鈥檚 a gap? If you鈥檝e added a border to your bars you鈥檙e asking users to implicitly remove the border in evaluating bar size, so why should zero be an exception?
Also re: hover - makes sense to include the lines, though this gets tricky if there鈥檚 overlap like stacking.
Thanks. Consider, for example, a bar chart showing temperature vs date. I need a way to distinguish 0 ("today, the temperature was 0 degrees") from null (today was a weekend and I didn't record the temperature).
I think that Plotly correctly handles nulls by not plotting the point at all, nor does it give a hover.
But it's imperfect for zeros: a zero-height bar is treated more like a null-bar than a zero-valued bubble.
I think Ploty should:
(I also show the word "zero" as text, with textposition=outside; this is an option which is already available).
Thanks for the info @RichardNeill
I agree 0 and null should be treated differently here.
It's great that the bar now appears (as expected, a zero-height area, but with a thin non-zero border).
However, it's still not possible to see the tooltip - because the hover only works on the main area of a bar, and not over its border. (This is true for non-zero bars too). So it it possible to enable the hover tooltip when the mouse goes over a bar's border? Thanks
Most helpful comment
Thanks for the info @RichardNeill
I agree
0andnullshould be treated differently here.