# [Matplotlib-users] How does the x coordinates work for plt.bar()?

Paul Hobson pmhobson at gmail.com
Fri Sep 6 16:24:32 EDT 2019

```Five of the same units of your x-axis, which in this case, is points on
-Paul

On Fri, Sep 6, 2019 at 12:32 PM Sreyan Chakravarty <sreyan32 at gmail.com>
wrote:

> I am unable to understand how the  plt.bar() function actually works.
>
> Take the following code for example:
>
> from collections import Countergrades = [83, 95, 91, 87, 70, 0, 85, 82, 100, 67, 73, 77, 0]
> # Bucket grades by decile, but put 100 in with the 90shistogram = Counter(min(grade // 10 * 10, 90) for grade in grades)
> plt.bar([x + 5 for x in histogram.keys()],  # Shift bars right by 5
>         histogram.values(),                 # Give each bar its correct height
>         10,                                 # Give each bar a width of 10
>         edgecolor=(0, 0, 0))                # Black edges for each bar
>
>
> What does it mean by shift bars by 5 in the plt.bar() call? Does it mean
> by 5 pixels? 5%? 5% of what?
>
> These measurements make no sense. Can someone explain to me how this works?
> --
> Regards,
> Sreyan Chakravarty
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20190906/a7f198d9/attachment-0001.html>
```