Python 如何从分组条形图Matplotlib中删除空格

Python 如何从分组条形图Matplotlib中删除空格,python,pandas,matplotlib,bar-chart,Python,Pandas,Matplotlib,Bar Chart,如何从Matplotlib中的分组条形图中删除空格。我的图表大小为3.5x4英寸 fig= plt.figure(figsize=(3.5,4),dpi=600) 这是我的密码 index = np.arange(n_groups) bar_width = 0.05 rects1 = plt.bar(index, SeriesA_1, bar_width) rects2 = plt.bar(index + 0.05, SeriesA_2, bar_width) rects3 = plt.ba

如何从Matplotlib中的分组条形图中删除空格。我的图表大小为3.5x4英寸

fig= plt.figure(figsize=(3.5,4),dpi=600)
这是我的密码

index = np.arange(n_groups)
bar_width = 0.05

rects1 = plt.bar(index, SeriesA_1, bar_width)
rects2 = plt.bar(index + 0.05, SeriesA_2, bar_width)
rects3 = plt.bar(index + 0.10, SeriesA_3, bar_width)
rects4 = plt.bar(index + 0.15, SeriesB_1, bar_width)
rects5 = plt.bar(index + 0.20, SeriesB_2, bar_width)
rects6 = plt.bar(index + 0.25, SeriesB_3, bar_width)
plt.ylim((0,14))
输出:

  • 由于
    条形图的宽度为0.05,并且每组绘制6个项目,因此每组最多使用0.3个项目

  • 索引处绘制,即每组跳1

试用

plt(0.3 * index + ...
在每个地方,而不是当前

plt(index + ...
你现在有了