def test_basic(object):
     s = bt.stack("foo", "junk")
     assert isinstance(s, dict)
     assert list(s.keys()) == ["expr"]
     assert isinstance(s['expr'], Stack)
     assert s['expr'].fields == ('foo', 'junk')
示例#2
0
#settings to simulate my setup
width_group = 0.8
gap = 0.02

#here I am calculating teh dodges/bar widths automatically
width_bar = round((width_group - ((len(fruits) - 1) * gap)) / len(fruits), 3)
# dodges = np.linspace(-0.5*(len(fruits)*width_bar+((len(fruits)-1)*gap))+(width_bar*.5),
#                          0.5*(len(fruits)*width_bar+((len(fruits)-1)*gap))-(width_bar*.5),
#                          len(fruits))

#loop that creates stacked vbars. I could not get vbar_stack to work in my other code.
bottom_fields = []
top_fields = []
for bar, fruit in enumerate(fruits):
    top_fields.append(fruit)
    stack_fig.vbar(bottom=stack(*bottom_fields),
                   top=stack(*top_fields),
                   x='years',
                   width=width_group,
                   source=source,
                   color=colors[bar])
    bottom_fields.append(fruit)

#set up layout
#column = column([stack_fig])


# #bounce wrapper to index columns
# @bounce([1, 2, 3, 4])
def get_update(attr, old, new):
示例#3
0
 def test_basic(object):
     s = bt.stack("foo", "junk")
     assert isinstance(s, dict)
     assert list(s.keys()) == ["expr"]
     assert isinstance(s['expr'], Stack)
     assert s['expr'].fields == ('foo', 'junk')
示例#4
0
 def test_basic(self) -> None:
     val = bt.stack("foo", "baz")
     assert isinstance(val, Expr)
     assert isinstance(val.expr, Stack)
     assert val.expr.fields == ('foo', 'baz')