styling_glyph_selections_plotting_glyph.py — Anaconda Enterprise 4.4 documentation

Anaconda Enterprise: Documentation

# styling_glyph_selections_plotting_glyph.py

    from bokeh.io import output_file, show
    from bokeh.plotting import figure
    from bokeh.models import Circle

    output_file("styling_selections.html")

    plot = figure(plot_width=400, plot_height=400, tools="tap", title="Select a circle")
    renderer = plot.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=50)

    selected_circle = Circle(fill_alpha=1, fill_color="firebrick", line_color=None)
    nonselected_circle = Circle(fill_alpha=0.2, fill_color="blue", line_color="firebrick")

    renderer.selection_glyph = selected_circle
    renderer.nonselection_glyph = nonselected_circle

    show(plot)