I never got the trick with set_yscale="clip" to work for my plots (MPL
1.1.0).
So I'm passing my error values to this little function in order to correct
the yerr_neg:

def filt_neg_err(y, yerr, set_ymin=1e-6):
    ymin = y - yerr
    filt = ymin < 0
    yerr_pos = yerr.copy()
    yerr_neg = yerr.copy()
    yerr_neg[filt] =  y[filt] - set_ymin
    return np.array([yerr_neg, yerr_pos])

Cheers,
Arne


Benjamin Root-2 wrote:
> 
> On Fri, Mar 9, 2012 at 1:14 PM, Wolfgang Draxinger <
> wdraxinger.maill...@draxit.de> wrote:
> 
>> On Fri, 9 Mar 2012 11:19:15 -0600
>> Benjamin Root <ben.r...@ou.edu> wrote:
>>
>> > Can I have the data you used to produce these errorbars so I can test
>> > this bug?
>>
>> Here's the data
>>
>> #  Fluence.... -sigma     Signal...  -sigma       area
>>      1127      48.32      9.114      10.31     0.1318
>>  1.127e+04      482.9      35.96      16.15     0.4994
>>  1.127e+05       4829      231.2      101.1      2.568
>>  1.127e+06  4.829e+04       4631       1689      12.22
>>
>>
> Ah, finally figured it out.  The issue is that your y-value for that error
> bar is 9.114, but you want to plot error bars that are +/-10.31.  That
> line
> gets thrown out by matplotlib because you can't plot at negative values
> for
> log scale.  There is a trick that might work.  The set_yscale method has a
> kwarg "nonposy" which could be set to "clip".  You could also try setting
> to the "symlog" scale which might let you get away with a negative value.
> 
> I hope that helps!
> Ben Root
> 
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: 
http://old.nabble.com/Errorbars-not-drawn-correctly-in-logarithmic-scales-tp33469114p33544881.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to