Matplotlib change gap between bars and add black outline
matplotlib, python
Solution
If the points on the x axis are equally spaced, you can set the width of the bars equal to the difference between x coordinates,
plt.bar(x, y, width=x[1]-x[0])
If the x coordinates are unequally spaced, you need to provide a list of widths, which correspond to the distance between successive bars.
In order to still leave some space between the bars, you can then adapt the width. E.g. if you want to have 20% spacing between bars,
plt.bar(x, y, width=(x[1]-x[0])*0.8)
To show the outline, use `ec="black"` as further argument.
Problem
I plotted some graph by: ``` plt.bar(TIME, MC_SIM, width=2000) ``` I have: How can I plot it with another gap between bars and black outline? Like this: