def test_bar_stacking(): bar1, bar2, bar3 = BarGlyph('a', 5), BarGlyph('a', 2), BarGlyph('b', 2) stack(bar1, bar2, bar3) # are stacked assert bar1.y_max == bar2.y_min # not stacked assert bar3.y_min == 0.0
def test_area_stacking(): area1 = AreaGlyph(x=[1, 2, 3, 4, 5], y=[2, 9, 2, 5, 10]) area2 = AreaGlyph(x=[1, 2, 3, 4, 5], y=[1, 1, 1, 1, 1]) stack(area1, area2) area2_stacked_values = [0, 3, 10, 3, 6, 11, 0, 0, 10, 5, 2, 9, 2, 0] comparison = pd.Series(area2_stacked_values) - pd.Series( area2.df['y_values'].values[0]) assert comparison.sum() == 0
def test_area_stacking(): area1 = AreaGlyph(x=[1, 2, 3, 4, 5], y=[2, 9, 2, 5, 10]) area2 = AreaGlyph(x=[1, 2, 3, 4, 5], y=[1, 1, 1, 1, 1]) stack(area1, area2) area2_stacked_values = [0, 3, 10, 3, 6, 11, 0, 0, 10, 5, 2, 9, 2, 0] comparison = pd.Series(area2_stacked_values) - pd.Series(area2.df[ 'y_values'].values[0]) assert comparison.sum() == 0