Вы были близки.Вам просто нужно использовать align=center
и затем переименовать тиковые метки, как вы делаете без смещения тиков на 0.5
.Я заменил coef_names
на names
, так как первый не был определен в предоставленном вами коде.
names = [1, 2, 3]
fig, axs = plt.subplots(3,1, figsize=(12, 24))
ind = np.arange(len(names)) # the x locations for the groups
width = 0.35 # the width of the bars
axs[0].barh(ind, [3, 4, 5], width, color='red', align='center',label='demo')
axs[0].set(yticks=ind , yticklabels=names)
