0

This is the part of the code that plots the bars

x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
...
width=0.7
tonto1 = ax1.bar(x,WRF2,width,alpha=1.0, edgecolor='black',color=colorG)
vonvo1 = ax2.bar(x,WRF1,width,alpha=1.0, edgecolor='black',color=colorG)

tinti = ax1.set_xticks(x)
tinti2 = ax1.set_xticklabels(clusters,rotation=60,fontsize=5)
ax1.set_ylim([0.0,350.0])
ax1.set_ylabel("Time (s)", fontsize=6.0)

vinvi = ax2.set_xticks(x)
vinvi2 = ax2.set_xticklabels(clusters,rotation=60,fontsize=5)
ax2.set_ylabel("Performance (normalized per core)", fontsize=6.0)

plt.tight_layout()
plt.savefig('***', format='png', dpi=300)
plt.show()

What I don't understand is why the annotation is as shown in the image. enter image description here Why is it like grouping some and not using x to locate the (xticks)labels? Thanks.

1 Answers1

0

The x tick labels are currently center aligned, it just doesn't look that way because the tick labels are very long (look at the center of each label and you can see it lines up). See this post for potential fixes. The simplest is to add ha=right to your set_xticklabels commands.

falafelocelot
  • 548
  • 3
  • 12