Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Thanks ! I knew that it was just a little mistake which cost me nearly 2 hours :D But what if I want to make the bars wider? Commented Jan 6, 2018 at 14:42
  • As long as the bar width is smaller or equal to 1 / number_of_bars_in_group you won't have overlap. The 1 is there because that's the space between two distinct groups. Commented Jan 6, 2018 at 14:43
  • Okay. But sometimes you need to make it wider than 1. For example if I add some labels like you do in your examples like "10 000" or even bigger numbers. These numbers would overlap each other if the bars have only a width <1. Commented Jan 6, 2018 at 14:46
  • You choose a "distance" of 1 between groups by using index = np.arange(3). If you want a distance of 2 you should be using [0, 2, 4] (for example index = np.arange(n_groups) * 2), in that case you also need to double the barwidth. However matplotlib will always scale the image, so probably making the fontsize of the labels smaller will be the smarter move. Commented Jan 6, 2018 at 14:49
  • Okay now I get it ! Thank you very much !! Commented Jan 6, 2018 at 14:50