def get_base_figure(): tools = "pan,wheel_zoom,box_zoom,reset,resize" # Define the figure. p = Figure( plot_height=1000, plot_width=1000, webgl=True, tools=tools, ) p.grid.grid_line_color = None p.axis.visible = False p.title.text = "AtlasCC: An Atlas of Coiled Coils" p.toolbar.logo = None p.outline_line_width = 5 p.outline_line_color = "Black" return p
def style_snapshot(figure: Figure) -> Figure: """Style a bokeh figure as a configuration snapshot. This is collection of style changes to make the output of a snapshot consistent and nice. Primarily it removes all the extra stuff which isn't helpful in defining the configuration like the axes, and the interactive tools. """ figure.axis.visible = False figure.xgrid.visible = False figure.ygrid.visible = False figure.toolbar_location = None figure.toolbar.logo = None figure.outline_line_width = 0 figure.outline_line_alpha = 0 return figure
################################### # Figures # ################################### # helper line glyph for every plot aux_line_glyph = MultiLine(xs='x', ys='y', line_width=2, line_dash=[1,2], line_color='gray') ###### MAIN PLOT (beam, supports, load) ###### # define plot: plot_main = Figure(title="Rod with Supports and Load", tools="", x_range=x_range, y_range=(-2.0,2.5), height=fig_height) # set properties plot_main.axis.visible = False plot_main.outline_line_width = 2 plot_main.outline_line_color = "Black" plot_main.title.text_font_size = "13pt" plot_main.toolbar.logo = None # plot error message if both supports are set to sliding error_label = LabelSet(x='x', y='y', text='name', source=error_msg) plot_main.add_layout(error_label) plot_main.add_glyph(error_msg_frame,Rect(x="x", y="y", width=8, height=1, angle=0, fill_color='red', fill_alpha=0.2)) # plot helper line plot_main.add_glyph(aux_line, aux_line_glyph) # measures beam_measure_doublearrow_glyph = Arrow(start=OpenHead(line_color=c_black, line_width=2, size=8), end=OpenHead(line_color='black',line_width= 2, size=8), x_start=xr_start, y_start=-1.2, x_end=xr_end, y_end=-1.2, line_width=5, line_color=c_black)
f2.arrow_source.data = dict(xS=[], xE=[], yS=[], yE=[], lW = []) button.on_click(button_fun) rbutton.on_click(init) init() create_orig(orig) ps = 0.3 plot = Figure(tools = "",title="Maxwell",title_location = "above", x_range=(0.1-ps,0.8+ps), y_range=(0.0,1.0)) plot.line(x='x', y='y', source=orig.pts, color='Black',line_width=3) plot.line(x='x', y='y', source=f1.pts, color="#808080",line_width=5) plot.line(x='x', y='y', source=f2.pts, color="#E37222",line_width=5) plot.line(x='x', y='y', source=t_line, color="Black",line_width=5) plot.triangle(x='x', y='y', size = 'size', source= f1.tri,color="#808080", line_width=2) plot.triangle(x='x', y='y', size = 'size', source= f2.tri,color="#E37222", line_width=2) plot.axis.visible = False plot.outline_line_width = 7 plot.outline_line_alpha = 0.3 plot.outline_line_color = "Black" plot.title.text_color = "black" plot.title.text_font_style = "bold" plot.title.align = "center" labels1 = LabelSet(x='x', y='y', text='name', level='glyph', x_offset=0, y_offset=0, source=f1.label, render_mode='canvas') labels2 = LabelSet(x='x', y='y', text='name', level='glyph', x_offset=0, y_offset=0, source=f2.label, render_mode='canvas') #P arrow: p1_arrow_glyph = Arrow(end=NormalHead(line_color="#0065BD",line_width= 4, size=10), x_start='xS', y_start='yS', x_end='xE', y_end='yE',line_width= "lW", source=f1.arrow_source,line_color="#0065BD")