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 <[email protected]>
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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to