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

Function test_hist_stacked_step_geometry

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

Source from the content-addressed store, hash-verified

5157
5158
5159def test_hist_stacked_step_geometry():
5160 bins = [0, 1, 2, 3]
5161 data_1 = [0, 0, 1, 1, 1, 2]
5162 data_2 = [0, 1, 2]
5163 tops = [
5164 [[0, 0], [0, 2], [1, 2], [1, 3], [2, 3], [2, 1], [3, 1], [3, 0]],
5165 [[0, 2], [0, 3], [1, 3], [1, 4], [2, 4], [2, 2], [3, 2], [3, 1]],
5166 ]
5167 bottoms = [
5168 [[2, 0], [2, 0], [1, 0], [1, 0], [0, 0]],
5169 [[2, 1], [2, 3], [1, 3], [1, 2], [0, 2]],
5170 ]
5171 combined = [t + b for t, b in zip(tops, bottoms)]
5172
5173 for histtype, xy in [('step', tops), ('stepfilled', combined)]:
5174 _, _, patches = plt.hist([data_1, data_2], bins=bins, stacked=True,
5175 histtype=histtype)
5176 assert len(patches) == 2
5177 polygon, = patches[0]
5178 assert_array_equal(polygon.get_xy(), xy[0])
5179 polygon, = patches[1]
5180 assert_array_equal(polygon.get_xy(), xy[1])
5181
5182
5183def test_hist_stacked_step_bottom_geometry():

Callers

nothing calls this directly

Calls 2

histMethod · 0.80
get_xyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…