errorbar - end bars not visible

Damon McDougall wrote:

···

On Sun, Jan 27, 2013 at 11:51 AM, Neal Becker > <ndbecker2@...149...> wrote:

Damon McDougall wrote:

On Sun, Jan 27, 2013 at 8:56 AM, Neal Becker >>> <ndbecker2@...149...> wrote:

Simple example: the bars on the two x axis ends are not visible.

x = [3, 6, 10]
y = [1, 2, 3]
import matplotlib.pyplot as plt

plt.errorbar (x, y, 0.2)

Try adding a plt.xlim(2, 11) here.

plt.show()

Yes that'll fix it - but ideally autoscaling should work correctly.

That behaviour of autoscale appears to be consistent with
plt.plot(range(3)), for example. That is, the axis limits butt up
against the plotted data.

By 'work correctly', do you mean that the axis limits should be padded
so there is a whitespace border surrounding the data being plotted?

I think you'll agree the original result in not visually appealing or clear.
The most obvious way to improve it would be to select axis limits a bit larger.
At least large enough to completely show the error bar; I suspect a bit of
whitespace would be even more clear.

Indeed, I do agree.

I have actually changed my mind about this behaviour being consistent
with plt.plot. I feel like the 'feet' on the error bars should be
taken into account during the autoscaling procedure. This will result
in the autoscaling procedure adding a small amount of whitespace such
that the feet are then visible after a call to plt.show().

I have opened a new issue on our github issue tracker. See
https://github.com/matplotlib/matplotlib/issues/1711

Thanks for reporting the problem, Neal.

···

On Sun, Jan 27, 2013 at 12:28 PM, Neal Becker <ndbecker2@...149...> wrote:

Damon McDougall wrote:

On Sun, Jan 27, 2013 at 11:51 AM, Neal Becker >> <ndbecker2@...149...> wrote:

Damon McDougall wrote:

On Sun, Jan 27, 2013 at 8:56 AM, Neal Becker >>>> <ndbecker2@...149...> wrote:

Simple example: the bars on the two x axis ends are not visible.

x = [3, 6, 10]
y = [1, 2, 3]
import matplotlib.pyplot as plt

plt.errorbar (x, y, 0.2)

Try adding a plt.xlim(2, 11) here.

plt.show()

Yes that'll fix it - but ideally autoscaling should work correctly.

That behaviour of autoscale appears to be consistent with
plt.plot(range(3)), for example. That is, the axis limits butt up
against the plotted data.

By 'work correctly', do you mean that the axis limits should be padded
so there is a whitespace border surrounding the data being plotted?

I think you'll agree the original result in not visually appealing or clear.
The most obvious way to improve it would be to select axis limits a bit larger.
At least large enough to completely show the error bar; I suspect a bit of
whitespace would be even more clear.

--
Damon McDougall
http://www.damon-is-a-geek.com
Institute for Computational Engineering Sciences
201 E. 24th St.
Stop C0200
The University of Texas at Austin
Austin, TX 78712-1229