def multiline_plot(figure_info, source):

    fig = Figure(plot_width=figure_info["plot_width"],
                 plot_height=figure_info["plot_height"],
                 title=figure_info["title"], x_axis_type = "datetime")

    for idx in range(1, len(figure_info["names"])):
        legend_name = str(figure_info["legends"][idx-1]) + " "

        fig.line(source=source, x=figure_info["names"][0], y=figure_info["names"][idx],
                 line_width=figure_info["line_widths"][idx - 1], alpha=figure_info["alphas"][idx - 1],
                 color=figure_info["colors"][idx - 1], legend=legend_name)

    fig.legend.location = figure_info["legend_location"]
    fig.xaxis.axis_label = figure_info["xaxis_label"]
    fig.yaxis.axis_label = figure_info["yaxis_label"]
    fig.title.align = figure_info["title_align"]

    fig.logo = None
    fig.toolbar_location = None

    return fig
def multi_plot(figure_info, source):

    fig = Figure(plot_width=figure_info["plot_width"],
                 plot_height=figure_info["plot_height"],
                 title=figure_info["title"], x_axis_type = "datetime")

    fig.yaxis.axis_label = figure_info["yaxis_label"]

    my_y_label = figure_info["secondary_y_label"]

    fig.extra_y_ranges = {my_y_label: Range1d(start=0, end=figure_info["max_unemployment"])}
    fig.add_layout(LinearAxis(y_range_name=my_y_label,  axis_label=my_y_label), 'right')


    for idx in range(1, len(figure_info["names"])):
        legend_name = str(figure_info["legends"][idx-1]) + " "

        if "Unem" not in figure_info["names"][idx]:

            fig.vbar(source=source, x=figure_info["names"][0], top=figure_info["names"][idx],
                     bottom = 0, width = 1000000000, color = figure_info["colors"][idx-1], fill_alpha = 0.2,
                     line_alpha = 0.1, legend = legend_name)

        else:

           fig.line(source=source, x = figure_info["names"][0], y = figure_info["names"][idx],
                     line_width = figure_info["line_widths"][idx-1], alpha = figure_info["alphas"][idx-1],
                     color = figure_info["colors"][idx-1], legend = legend_name, y_range_name=my_y_label)

    fig.legend.location = figure_info["legend_location"]
    fig.xaxis.axis_label = figure_info["xaxis_label"]
    # fig.yaxis.axis_label = figure_info["yaxis_label"]
    fig.title.align = figure_info["title_align"]

    fig.logo = None
    fig.toolbar_location = None

    return fig
plot_field.line('x', 'y', source=source_curve, color='black', legend='curve')
# Plot parameter point
plot_field.scatter('x', 'y', source=source_param, color='black', legend='c(t)')
# Plot corresponding tangent vector
plot_field.segment('x0', 'y0', 'x1', 'y1', source=source_param, color='black')
plot_field.patches('xs', 'ys', source=source_param, color='black')

# Generate a figure container for the integral value
plot_integral = Figure(title_text_font_size="12pt",
                       plot_height=200,
                       plot_width=400,
                       title="Integral along curve",
                       x_range=[curveintegral_settings.parameter_min, curveintegral_settings.parameter_max],
                       y_range=[-10,10]
                       )
plot_integral.logo = None

plot_integral.scatter('t',0, source=source_param, color='black')
plot_integral.line('t','integrand',source=source_integral, color='black')
plot_integral.line('t','integral',source=source_integral, color='red')


def refresh_quiver():
    """
    periodically called function that updates data with respect to the current user view, if the user view has changed.
    :return:
    """
    user_view_has_changed = my_bokeh_utils.check_user_view(source_view.data, plot_field)
    if user_view_has_changed:
        u_str = u_input.value
        v_str = v_input.value
Exemplo n.º 4
0
plot.xaxis.axis_label = "Total Score"
plot.xaxis.axis_line_color = None
plot.xaxis.minor_tick_line_color = None

plot.yaxis.axis_label = "Frequency"
plot.yaxis.axis_line_color = None
plot.yaxis.major_tick_line_color = None
plot.yaxis.minor_tick_line_color = None

plot.xgrid.grid_line_color = None
plot.ygrid.grid_line_color = None

plot.outline_line_color = None

plot.logo = None

bar_hover = HoverTool(renderers=[freq_bars], tooltips=[("Range", '@left_edge to @right_edge'),
                      ("Frequency", '@hist'), ("Total # Samples", '@samples')])
plot.add_tools(bar_hover)

# Dropdown and interactive UI elements
selectable_years = ["All Years"] + list(map(str, compdata['Year'].unique()))
selectable_events = ["All Events"] + [event.replace(' Score', '') for event in compdata.columns.values.tolist()[5:13]]

select_year = Select(title="Year", value="All Years", options=selectable_years)
select_event = Select(title="Event", value="All Events", options=selectable_events)


# Interactive callbacks
def update_histogram_data(year='All Years', event='All Events'):
Exemplo n.º 5
0
plot_field.scatter('x', 'y', source=source_param, color='black', legend='c(t)')
# Plot corresponding tangent vector
plot_field.segment('x0', 'y0', 'x1', 'y1', source=source_param, color='black')
plot_field.patches('xs', 'ys', source=source_param, color='black')

# Generate a figure container for the integral value
plot_integral = Figure(title_text_font_size="12pt",
                       plot_height=200,
                       plot_width=400,
                       title="Integral along curve",
                       x_range=[
                           curveintegral_settings.parameter_min,
                           curveintegral_settings.parameter_max
                       ],
                       y_range=[-10, 10])
plot_integral.logo = None

plot_integral.scatter('t', 0, source=source_param, color='black')
plot_integral.line('t', 'integrand', source=source_integral, color='black')
plot_integral.line('t', 'integral', source=source_integral, color='red')


def refresh_quiver():
    """
    periodically called function that updates data with respect to the current user view, if the user view has changed.
    :return:
    """
    user_view_has_changed = my_bokeh_utils.check_user_view(
        source_view.data, plot_field)
    if user_view_has_changed:
        u_str = u_input.value
Exemplo n.º 6
0
plot.xaxis.axis_label = "Total Score"
plot.xaxis.axis_line_color = None
plot.xaxis.minor_tick_line_color = None

plot.yaxis.axis_label = "Frequency"
plot.yaxis.axis_line_color = None
plot.yaxis.major_tick_line_color = None
plot.yaxis.minor_tick_line_color = None

plot.xgrid.grid_line_color = None
plot.ygrid.grid_line_color = None

plot.outline_line_color = None

plot.logo = None

bar_hover = HoverTool(renderers=[freq_bars],
                      tooltips=[("Range", '@left_edge to @right_edge'),
                                ("Frequency", '@hist'),
                                ("Total # Samples", '@samples')])
plot.add_tools(bar_hover)

# Dropdown and interactive UI elements
selectable_years = ["All Years"] + list(map(str, compdata['Year'].unique()))
selectable_events = ["All Events"] + [
    event.replace(' Score', '')
    for event in compdata.columns.values.tolist()[5:13]
]

select_year = Select(title="Year", value="All Years", options=selectable_years)