# BarChart without axes neglects the last zero of a list

Creating a BarChart with {1, 2, 3, 0} as

BarChart[{1, 2, 3, 0}, Axes -> False, Frame -> True]


gives me only the first three bars, a chart identical to just

BarChart[{1, 2, 3}, Axes -> False, Frame -> True]

1. Is this an intended behaviour or a bug?

2. (Originally I asked for a workaround. I think I can just use Axes instead of Frame. Let me ask this instead for the sake of knowledge.) What to do if I need Frame but not Axes?

I'm using Mathematica 9.

-
is that cheating? BarChart[{1, 2, 3, 0}, AxesStyle -> Directive[Opacity[0]], Frame -> True]. There must be a smarter way - –  Pinguin Dirk Apr 4 '13 at 11:23
Your workaround is great. I think you have answered Question 2! Could you please post it as an answer so I can mark the question as solved? –  Taiki Apr 4 '13 at 12:45

I cannot answer why this is happening. Intuitively, I interpret BarChart as a chart with no "real", scaled, x-axis. Thus, a frame does not really make a lot of sense to me (with ticks)...

Nevertheless, you could use the following work-around to make the axis "vanish":

BarChart[{1, 2, 3, 0}, AxesStyle -> Directive[Opacity[0]], Frame -> True]


This will keep the last (zero) bar:

-
Thank you for your idea. Now I'll just customise the chart further, like this. –  Taiki Apr 4 '13 at 15:05

Are you sure it's not there? I get this picture:

What appears to be nothingness attached on the end is really a bar of height zero. You can see this more clearly if you do it in 3D

BarChart3D[{1, 2, 3, 0}]


which gives

Now you can see the stump of the zero bar. Another way to see it would be:

BarChart[{1, 2, 3, 0}, LabelingFunction -> (Placed[#, Above] &)]


which labels things with the number.

-
Thank you. I just updated my question a bit. It seems the option Axes -> False causes the last zero to disappear. –  Taiki Apr 4 '13 at 10:26

Perhaps you could do:

GraphicsRow[BarChart[#, AxesOrigin -> {0, -1}] & /@ {{1, 2, 3, 0}, {1, 2, 3}}]


Just to be sure

-
Thank you. Now I have updated my question. With Axes set to False, the last zero really disappears. –  Taiki Apr 4 '13 at 10:39