MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_bar_label_location_center

Function test_bar_label_location_center

lib/matplotlib/tests/test_axes.py:9343–9353  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9341
9342
9343def test_bar_label_location_center():
9344 ax = plt.gca()
9345 ys, widths = [1, 2], [3, -4]
9346 rects = ax.barh(ys, widths)
9347 labels = ax.bar_label(rects, label_type='center')
9348 assert labels[0].xy == (0.5, 0.5)
9349 assert labels[0].get_horizontalalignment() == 'center'
9350 assert labels[0].get_verticalalignment() == 'center'
9351 assert labels[1].xy == (0.5, 0.5)
9352 assert labels[1].get_horizontalalignment() == 'center'
9353 assert labels[1].get_verticalalignment() == 'center'
9354
9355
9356@image_comparison(['test_centered_bar_label_nonlinear.svg'], style='mpl20')

Callers

nothing calls this directly

Calls 5

gcaMethod · 0.80
barhMethod · 0.80
bar_labelMethod · 0.80
get_verticalalignmentMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…