Hi,

I just noticed that this:

x = np.arange(10)

y = np.zeros(10)

y[5] = 1

plt.bar(x, y)

Will generate a big box for x = 5 with x 0:5 and 6: stripped, whereas this:

y += 0.000001

plt.bar(x, y)

Will generate a bar plot going from x = 0 to 9 with a bar at 5 as I

was expecting.

If I make a zeros vector with two discontiguous 1 values, then I also

get the full x range, with two spikes.

y = np.zeros(10)

y[2] = 1

y[5] = 1

plt.bar(x, y)

Is this expected? It certainly surprised me...

Matthew

Which version of matplotlib are you running? I could have sworn this was fixed awhile ago. If I understand the problem correctly, essentially, the autoscalling was clipping empty patches out.

Ben Root

## ···

On Sun, Oct 26, 2014 at 2:57 AM, Matthew Brett <matthew.brett@…83…287…> wrote:

Hi,

I just noticed that this:

x = np.arange(10)

y = np.zeros(10)

y[5] = 1

plt.bar(x, y)

Will generate a big box for x = 5 with x 0:5 and 6: stripped, whereas this:

y += 0.000001

plt.bar(x, y)

Will generate a bar plot going from x = 0 to 9 with a bar at 5 as I

was expecting.

If I make a zeros vector with two discontiguous 1 values, then I also

get the full x range, with two spikes.

y = np.zeros(10)

y[2] = 1

y[5] = 1

plt.bar(x, y)

Is this expected? It certainly surprised me…

Matthew

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I'm embarrassed to say that I didn't look at my version, and now I do,

it was 1.3.1, and you are quite right, 1.4.0 (and 1.4.2) fixes that.

Thanks, and, sorry to write too quickly,

Matthew

## ···

On Mon, Oct 27, 2014 at 11:06 AM, Benjamin Root <ben.root@...1304...> wrote:

Which version of matplotlib are you running? I could have sworn this was

fixed awhile ago. If I understand the problem correctly, essentially, the

autoscalling was clipping empty patches out.