예제 #1
0
def on_change_module_plot_type(widget, event, data):
    if date_selection_waffle.v_model and parameter_selection_waffle.v_model:
        with waffle:
            waffle.clear_output()
            genotype = genotypes_selection_waffle.v_model
            vids = get_vid_of_genotype(misc.all_mtg, [genotype])
            df = extract_at_module_scale(misc.all_mtg, vids=vids)

            if aggfunc_selection_waffle.v_model == 'concat_string':
                tmp = df2waffle(df,
                                index='order',
                                date=date_selection_waffle.v_model,
                                variable=parameter_selection_waffle.v_model,
                                aggfunc=lambda x: ' '.join(x),
                                crosstab=False)
            else:
                tmp = df2waffle(df,
                                index='order',
                                date=date_selection_waffle.v_model,
                                variable=parameter_selection_waffle.v_model,
                                aggfunc=aggfunc_selection_waffle.v_model,
                                crosstab=False)

            fig = plot_waffle(
                tmp,
                #                               layout=layout,
                plot_func=data)

            display(fig)
예제 #2
0
def on_change_node_waffle_parameter(widget, event, data):
    if not date_selection_waffle.v_model:
        pass
    else:
        with waffle:
            waffle.clear_output()
            genotype = genotypes_selection_waffle.v_model
            vids = get_vid_of_genotype(misc.all_mtg, [genotype])
            df = extract_at_node_scale(misc.all_mtg, vids=vids)
            tmp = df2waffle(df,
                            index='rank',
                            date=date_selection_waffle.v_model,
                            variable=data,
                            order=order_selection_waffle.v_model)

            # TODO: remove the legend here (which only apply to branching_type)
            l_names = {
                "1": "Stolon",
                "2": "Vegetative bud",
                "3": "Initiated bud",
                "4": "Aborted bud",
                "5": "Floral bud",
                "6": "Branch crown"
            }

            fig = plot_waffle(
                tmp,
                #                             layout=layout,
                legend_name=l_names,
                plot_func=plot_type_waffle.v_model)
            display(fig)