Errorbar problem?

Hi,

I think I have a problem with errorbars in a log plot. The problem is
reproducible through the enclosed errorbar_log.py file. As you can see I
plot a point with y = 10**(-5) and I want the errorbars drawn from
10**(-5.5) to 10**(-4.5) which should be symmetric in this plot but isn't.

Here is the content of my errorbar_log.py file:

#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
x = 0.0
y = 10**(-5.0)
yerr_low = 10**(-5.5)
yerr_upp = 10**(-4.5)
ax.errorbar(x,y,yerr=[[yerr_low],[yerr_upp]],fmt='o',markersize=4)
ax.set_xlim(-1.0,1.0)
ax.set_ylim(1E-6,1E-3)
ax.set_yscale('log')
plt.savefig('errorbar.png')

···

---------------------------------------------

10**(-5.5) = 3.162277660168379e-06
and 10**(-4.5) = 3.1622776601683795e-05

but you can see that the lower boundary is not at the calculated value.
<http://matplotlib.1069221.n5.nabble.com/file/n40412/errorbar.png>

Do I misunderstand the behaviour of the errorbar function or is this a bug?

Cheers,
Markus

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Errorbar-problem-tp40412.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.

The bar is drawn from `y - yerr_low` to `y + yerr_upp`

ax.errorbar(x + .5,y,yerr=[[y - yerr_low],[yerr_upp -
y]],fmt='s',markersize=4)

will get you what you want.

Tom

···

On Fri, Feb 8, 2013 at 8:41 PM, Markus Haider <markus.haider@...850...> wrote:

Hi,

I think I have a problem with errorbars in a log plot. The problem is
reproducible through the enclosed errorbar_log.py file. As you can see I
plot a point with y = 10**(-5) and I want the errorbars drawn from
10**(-5.5) to 10**(-4.5) which should be symmetric in this plot but isn't.

Here is the content of my errorbar_log.py file:

#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
x = 0.0
y = 10**(-5.0)
yerr_low = 10**(-5.5)
yerr_upp = 10**(-4.5)
ax.errorbar(x,y,yerr=[[yerr_low],[yerr_upp]],fmt='o',markersize=4)
ax.set_xlim(-1.0,1.0)
ax.set_ylim(1E-6,1E-3)
ax.set_yscale('log')
plt.savefig('errorbar.png')

---------------------------------------------

10**(-5.5) = 3.162277660168379e-06
and 10**(-4.5) = 3.1622776601683795e-05

but you can see that the lower boundary is not at the calculated value.
<http://matplotlib.1069221.n5.nabble.com/file/n40412/errorbar.png>

Do I misunderstand the behaviour of the errorbar function or is this a bug?

Cheers,
Markus

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Errorbar-problem-tp40412.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

--
Thomas Caswell
tcaswell@...149...

Hi Tom,

Thank you very much for your answer. Indeed this solves my problem. However, I was wondering if the documentation on this is correct.

xerr/yerr: [ scalar | N, Nx1, or 2xN array-like ]
If a scalar number, len(N) array-like object, or an Nx1 array-like object, errorbars are drawn +/- value.
If a sequence of shape 2xN, errorbars are drawn at -row1 and +row2

This sounds to me that for a 2xN argument it should be drawn from the actual supplied value, or would you interpret this differently?

Thanks,
Markus

···

At http://matplotlib.org/api/axes_api.html?highlight=errorbar#matplotlib.axes.Axes.errorbar it says:

Am 2013-02-08 22:02, schrieb Thomas Caswell:

The bar is drawn from `y - yerr_low` to `y + yerr_upp`

ax.errorbar(x + .5,y,yerr=[[y - yerr_low],[yerr_upp -
y]],fmt='s',markersize=4)

will get you what you want.

Tom

On Fri, Feb 8, 2013 at 8:41 PM, Markus Haider <markus.haider@...850...> wrote:

Hi,

I think I have a problem with errorbars in a log plot. The problem is
reproducible through the enclosed errorbar_log.py file. As you can see I
plot a point with y = 10**(-5) and I want the errorbars drawn from
10**(-5.5) to 10**(-4.5) which should be symmetric in this plot but isn't.

Here is the content of my errorbar_log.py file:

#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
x = 0.0
y = 10**(-5.0)
yerr_low = 10**(-5.5)
yerr_upp = 10**(-4.5)
ax.errorbar(x,y,yerr=[[yerr_low],[yerr_upp]],fmt='o',markersize=4)
ax.set_xlim(-1.0,1.0)
ax.set_ylim(1E-6,1E-3)
ax.set_yscale('log')
plt.savefig('errorbar.png')

---------------------------------------------

10**(-5.5) = 3.162277660168379e-06
and 10**(-4.5) = 3.1622776601683795e-05

but you can see that the lower boundary is not at the calculated value.
<http://matplotlib.1069221.n5.nabble.com/file/n40412/errorbar.png>

Do I misunderstand the behaviour of the errorbar function or is this a bug?

Cheers,
Markus

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Errorbar-problem-tp40412.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

--
Thomas Caswell
tcaswell@...149...

Actually never mind, I think I just interpreted it wrong. However it could perhaps be more clear if it would say something like

If a sequence of shape 2xN, errorbars are drawn at y +/- row1/row2

Thanks,
Markus

···

Am 2013-02-09 13:49, schrieb Markus Haider:

Hi Tom,

Thank you very much for your answer. Indeed this solves my problem.
However, I was wondering if the documentation on this is correct.
At
http://matplotlib.org/api/axes_api.html?highlight=errorbar#matplotlib.axes.Axes.errorbar
it says:

xerr/yerr: [ scalar | N, Nx1, or 2xN array-like ]
If a scalar number, len(N) array-like object, or an Nx1 array-like
object, errorbars are drawn +/- value.
If a sequence of shape 2xN, errorbars are drawn at -row1 and +row2

This sounds to me that for a 2xN argument it should be drawn from the
actual supplied value, or would you interpret this differently?

Thanks,
Markus

Am 2013-02-08 22:02, schrieb Thomas Caswell:

The bar is drawn from `y - yerr_low` to `y + yerr_upp`

ax.errorbar(x + .5,y,yerr=[[y - yerr_low],[yerr_upp -
y]],fmt='s',markersize=4)

will get you what you want.

Tom

On Fri, Feb 8, 2013 at 8:41 PM, Markus Haider <markus.haider@...850...> wrote:

Hi,

I think I have a problem with errorbars in a log plot. The problem is
reproducible through the enclosed errorbar_log.py file. As you can see I
plot a point with y = 10**(-5) and I want the errorbars drawn from
10**(-5.5) to 10**(-4.5) which should be symmetric in this plot but isn't.

Here is the content of my errorbar_log.py file:

#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
x = 0.0
y = 10**(-5.0)
yerr_low = 10**(-5.5)
yerr_upp = 10**(-4.5)
ax.errorbar(x,y,yerr=[[yerr_low],[yerr_upp]],fmt='o',markersize=4)
ax.set_xlim(-1.0,1.0)
ax.set_ylim(1E-6,1E-3)
ax.set_yscale('log')
plt.savefig('errorbar.png')

---------------------------------------------

10**(-5.5) = 3.162277660168379e-06
and 10**(-4.5) = 3.1622776601683795e-05

but you can see that the lower boundary is not at the calculated value.
<http://matplotlib.1069221.n5.nabble.com/file/n40412/errorbar.png>

Do I misunderstand the behaviour of the errorbar function or is this a bug?

Cheers,
Markus

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Errorbar-problem-tp40412.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

--
Thomas Caswell
tcaswell@...149...

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

My default interpretation of errors is always relative to the value
because that is how they are reported (100+10-20 not 100+110-80).

(got your 2nd email while writing this)

Would you find this clearer? Maybe xerr and yerr should be split up

xerr/yerr: [ scalar | N, Nx1, or 2xN array-like ]
If a scalar number, len(N) array-like object, or an Nx1 array-like
object, errorbars are drawn x/y +/- value.
If a sequence of shape 2xN, errorbars are drawn at x/y - row1 and x/y + row2

Tom

···

On Sat, Feb 9, 2013 at 12:49 PM, Markus Haider <markus.haider@...850...> wrote:

Hi Tom,

Thank you very much for your answer. Indeed this solves my problem. However,
I was wondering if the documentation on this is correct.
At
http://matplotlib.org/api/axes_api.html?highlight=errorbar#matplotlib.axes.Axes.errorbar
it says:

xerr/yerr: [ scalar | N, Nx1, or 2xN array-like ]
If a scalar number, len(N) array-like object, or an Nx1 array-like object,
errorbars are drawn +/- value.
If a sequence of shape 2xN, errorbars are drawn at -row1 and +row2

This sounds to me that for a 2xN argument it should be drawn from the actual
supplied value, or would you interpret this differently?

Thanks,
Markus

Am 2013-02-08 22:02, schrieb Thomas Caswell:

The bar is drawn from `y - yerr_low` to `y + yerr_upp`

ax.errorbar(x + .5,y,yerr=[[y - yerr_low],[yerr_upp -
y]],fmt='s',markersize=4)

will get you what you want.

Tom

On Fri, Feb 8, 2013 at 8:41 PM, Markus Haider <markus.haider@...850...> >> wrote:

Hi,

I think I have a problem with errorbars in a log plot. The problem is
reproducible through the enclosed errorbar_log.py file. As you can see I
plot a point with y = 10**(-5) and I want the errorbars drawn from
10**(-5.5) to 10**(-4.5) which should be symmetric in this plot but
isn't.

Here is the content of my errorbar_log.py file:

#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
x = 0.0
y = 10**(-5.0)
yerr_low = 10**(-5.5)
yerr_upp = 10**(-4.5)
ax.errorbar(x,y,yerr=[[yerr_low],[yerr_upp]],fmt='o',markersize=4)
ax.set_xlim(-1.0,1.0)
ax.set_ylim(1E-6,1E-3)
ax.set_yscale('log')
plt.savefig('errorbar.png')

---------------------------------------------

10**(-5.5) = 3.162277660168379e-06
and 10**(-4.5) = 3.1622776601683795e-05

but you can see that the lower boundary is not at the calculated value.
<http://matplotlib.1069221.n5.nabble.com/file/n40412/errorbar.png>

Do I misunderstand the behaviour of the errorbar function or is this a
bug?

Cheers,
Markus

--
View this message in context:
http://matplotlib.1069221.n5.nabble.com/Errorbar-problem-tp40412.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

--
Thomas Caswell
tcaswell@...149...

--
Thomas Caswell
tcaswell@...149...

Hi Tom,

Yes, I would find the version you suggested clearer. I mean now that I know how to read it the old version seems quite logical, but if it would have been written the way you suggested I would not have made my misinterpretation.

Thank you for your help,
Cheers,
Markus

···

Am 2013-02-09 14:04, schrieb Thomas Caswell:

My default interpretation of errors is always relative to the value
because that is how they are reported (100+10-20 not 100+110-80).

(got your 2nd email while writing this)

Would you find this clearer? Maybe xerr and yerr should be split up

xerr/yerr: [ scalar | N, Nx1, or 2xN array-like ]
If a scalar number, len(N) array-like object, or an Nx1 array-like
object, errorbars are drawn x/y +/- value.
If a sequence of shape 2xN, errorbars are drawn at x/y - row1 and x/y + row2

Tom

On Sat, Feb 9, 2013 at 12:49 PM, Markus Haider <markus.haider@...850...> wrote:

Hi Tom,

Thank you very much for your answer. Indeed this solves my problem. However,
I was wondering if the documentation on this is correct.
At
http://matplotlib.org/api/axes_api.html?highlight=errorbar#matplotlib.axes.Axes.errorbar
it says:

xerr/yerr: [ scalar | N, Nx1, or 2xN array-like ]
If a scalar number, len(N) array-like object, or an Nx1 array-like object,
errorbars are drawn +/- value.
If a sequence of shape 2xN, errorbars are drawn at -row1 and +row2

This sounds to me that for a 2xN argument it should be drawn from the actual
supplied value, or would you interpret this differently?

Thanks,
Markus

Am 2013-02-08 22:02, schrieb Thomas Caswell:

The bar is drawn from `y - yerr_low` to `y + yerr_upp`

ax.errorbar(x + .5,y,yerr=[[y - yerr_low],[yerr_upp -
y]],fmt='s',markersize=4)

will get you what you want.

Tom

On Fri, Feb 8, 2013 at 8:41 PM, Markus Haider <markus.haider@...850...> >>> wrote:

Hi,

I think I have a problem with errorbars in a log plot. The problem is
reproducible through the enclosed errorbar_log.py file. As you can see I
plot a point with y = 10**(-5) and I want the errorbars drawn from
10**(-5.5) to 10**(-4.5) which should be symmetric in this plot but
isn't.

Here is the content of my errorbar_log.py file:

#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
x = 0.0
y = 10**(-5.0)
yerr_low = 10**(-5.5)
yerr_upp = 10**(-4.5)
ax.errorbar(x,y,yerr=[[yerr_low],[yerr_upp]],fmt='o',markersize=4)
ax.set_xlim(-1.0,1.0)
ax.set_ylim(1E-6,1E-3)
ax.set_yscale('log')
plt.savefig('errorbar.png')

---------------------------------------------

10**(-5.5) = 3.162277660168379e-06
and 10**(-4.5) = 3.1622776601683795e-05

but you can see that the lower boundary is not at the calculated value.
<http://matplotlib.1069221.n5.nabble.com/file/n40412/errorbar.png>

Do I misunderstand the behaviour of the errorbar function or is this a
bug?

Cheers,
Markus

--
View this message in context:
http://matplotlib.1069221.n5.nabble.com/Errorbar-problem-tp40412.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

--
Thomas Caswell
tcaswell@...149...

--
Thomas Caswell
tcaswell@...149...