# Missing bar when last value is 0

If I do:

``````bar(range(3), [1,0,2])
``````

… then I get 2 bars of a suitable width for a 3 bar chart, with a gap in between where the middle bar would be if not equal to 0. Yet if I do:

``````bar(range(3), [1,2,0])
``````

… then I get two bars of equal width. Is there a way to preserve the space for the missing bar?

This is an autoscaling issue, I think. Your best bet is to explicitly set the x limits yourself.

Cheers,

Ben Root

···

On Wednesday, September 19, 2012, Adam Davis wrote:

If I do:

``````bar(range(3), [1,0,2])
``````

… then I get 2 bars of a suitable width for a 3 bar chart, with a gap in between where the middle bar would be if not equal to 0. Yet if I do:

``````bar(range(3), [1,2,0])
``````

… then I get two bars of equal width. Is there a way to preserve the space for the missing bar?

Yes, that works. Many thanks.

···

On Thu, Sep 20, 2012 at 1:12 AM, Benjamin Root <ben.root@…1304…> wrote:

On Wednesday, September 19, 2012, Adam Davis wrote:

If I do:

``````bar(range(3), [1,0,2])
``````

… then I get 2 bars of a suitable width for a 3 bar chart, with a gap in between where the middle bar would be if not equal to 0. Yet if I do:

``````bar(range(3), [1,2,0])
``````

… then I get two bars of equal width. Is there a way to preserve the space for the missing bar?

This is an autoscaling issue, I think. Your best bet is to explicitly set the x limits yourself.

Cheers,

Ben Root