Example #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)
Example #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)
Example #3
0
def test_df2waffle():
    files = shared_data(openalea.strawberry).glob('*.mtg')
    mtg_path = dict((name(f), f) for f in files)
    mtg = read_mtg_file(mtg_path['Capriss'])

    df = extract_at_node_scale(mtg)

    node_scale = df2waffle(df,
                           index='rank',
                           date='2015/03/02',
                           variable='branching_type')
    assert node_scale.shape == (20, 9)

    df = extract_at_module_scale(mtg)
    module_scale = df2waffle(df,
                             index='order',
                             date='2015/03/02',
                             variable='crown_status',
                             aggfunc='median')
    assert module_scale.shape == (3, 9)
Example #4
0
def on_change_date_p3(widget, event, data):

    genotype = genotypes_selection_analyze.v_model
    vids = get_vid_of_genotype(misc.all_mtg, [genotype])
    df = extract_at_module_scale(misc.all_mtg, vids=vids)

    tmp = df2waffle(df,
                    index='order',
                    date=data,
                    variable='stage',
                    crosstab=True)

    try:
        fig = plot_pie(tmp)
        fig.update_layout(
            title="Percentage representation of each stage at one date")
        transfert_figure_pie(fig, pie_plantscale)
    except ValueError:
        pass