Внутренне, позиции меток пронумерованы 0,1, ... Так что установка x-пределов немного перед 0 и после последней показывает их более центрированными.
Обычно бары рисуются с их «ногами» на земле, которые можно установить с помощью plt.ylim(0, ...)
. Незначительные тики могут быть расположены, например, с кратностью 0,2. Установка длины тиков на ноль позволяет подсчитывать позиции для сетки, но подавляет тиковую метку.
from matplotlib import pyplot as plt
from matplotlib.ticker import MultipleLocator
import numpy as np
labels = ['Test 1', 'Test 2']
values = [1, 0.7]
fig, ax = plt.subplots()
plt.vlines(labels, 0, values, colors='dodgerblue', alpha=.4, lw=7)
plt.xlim(-0.5, len(labels) - 0.5) # add some padding left and right of the bars
plt.ylim(0, 1.1) # bars usually have their 0 at the bottom
ax.xaxis.set_minor_locator(MultipleLocator(.2))
plt.tick_params(axis='x', which='both', length=0) # ticks not shown, but position serves for gridlines
plt.grid(axis='both', which='both', ls=':') # optionally set the linestyle of the grid
plt.show()
![resulting plot](https://i.stack.imgur.com/hjiWA.png)