bar, errorbar

Hi folks, It seems that 'bar' no longer supports

    > asymmetric errorbars. Am I meant to call both 'bar' and
    > 'errorbar' if I want asymmetric errorbars on my
    > histograms? Is there a canonical idiom?

    > Sorry if I missed a previous answer to this.

I don't use asymmetric error bars so don't have any ready test code,
but looking at the implementation, the xerr and yerr kwargs to bar are
passed on to errorbar after a bit of array conversion and length
checking. Does this not work for you? If not, can you send a snippet
of freestanding test code?

Thanks,
JDH

John et al,

I get this error, suggesting that yerr in bar() is not allowed to have
the same format as yerr in errorbar()
<<
if yerr is not None: assert len(yerr)==nbars, 'bar() argument \'yerr\'
must be len(%s) or scalar' % lenarg

So this works:
  pylab.errorbar(xrange(5), [2,5,3,4,7], yerr=[[1,4,2,3,6],[4,10,6,8,14]])
But this does not:
  pylab.bar(xrange(5), [2,5,3,4,7], yerr=[[1,4,2,3,6],[4,10,6,8,14]])

Version 0.87.5 (Debian)

If I'm right, then the assertion in bar() is misformed.
-C

···

On 11/6/06, John Hunter <jdhunter@...8...> wrote:

    > Hi folks, It seems that 'bar' no longer supports
    > asymmetric errorbars. Am I meant to call both 'bar' and
    > 'errorbar' if I want asymmetric errorbars on my
    > histograms? Is there a canonical idiom?

    > Sorry if I missed a previous answer to this.

I don't use asymmetric error bars so don't have any ready test code,
but looking at the implementation, the xerr and yerr kwargs to bar are
passed on to errorbar after a bit of array conversion and length
checking. Does this not work for you? If not, can you send a snippet
of freestanding test code?

Thanks,
JDH

--
Charles R. Twardy

If I'm right, then the assertion in bar() is misformed.

I'd suggest the following. Works for me, anyway. :slight_smile:

        if yerr is not None: assert (len(yerr)==nbars or (len(yerr)==2
and len(yerr[0])==len(yerr[1])==nbars)), 'bar() argument \'yerr\' must
be len(%s) (or a pair of such) or scalar' % lenarg

        if xerr is not None: assert (len(xerr)==nbars or (len(xerr)==2
and len(xerr[0])==len(xerr[1])==nbars)), 'bar() argument \'xerr\' must
be len(%s) (or a pair of such) or scalar' % lenarg

···

-C

On 11/6/06, John Hunter <jdhunter@...8...> wrote:

>
> > Hi folks, It seems that 'bar' no longer supports
> > asymmetric errorbars. Am I meant to call both 'bar' and
> > 'errorbar' if I want asymmetric errorbars on my
> > histograms? Is there a canonical idiom?
>
> > Sorry if I missed a previous answer to this.
>
> I don't use asymmetric error bars so don't have any ready test code,
> but looking at the implementation, the xerr and yerr kwargs to bar are
> passed on to errorbar after a bit of array conversion and length
> checking. Does this not work for you? If not, can you send a snippet
> of freestanding test code?
>
> Thanks,
> JDH
>

--
Charles R. Twardy

--
Charles R. Twardy