alpha=0.6, size='ptcex', color='ptcol', line_color="lcol", line_width=3) txt = Text(x='tsneX', y='tsneY', text='title', text_alpha='txt_alpha', text_align='center') p1.add_glyph(filsource, txt) hover = HoverTool() hover.tooltips = [('Votes', '@n_vote'), ('Adoption', '@vote'), ('Titre', '@title')] hover.renderers = [r1] p1.add_tools(hover) tool = PointDrawTool(renderers=[r1], num_objects=2000) p1.add_tools(tool) filsource.selected.js_on_change( 'indices', CustomJS(args=dict(source=filsource, s2=s2, div=div), code=""" var inds = cb_obj.indices; var d1 = source.data; var d2 = s2.data; d2['vote'] = [] d2['n_vote'] = [] d2['title'] = []
# Add legend p_world_covid.legend.location = "top_left" # Add a hover tool hover = HoverTool() hover.tooltips = [ #('Type', "$name"), ('', '$name: @$name{0,0.} on @date{%a-%b-%d}'), ] # hover.mode = 'vline' hover.formatters = { '@date': 'datetime', # use 'datetime' formatter for '@date' field '$name': 'printf' # use 'printf' formatter for the name of the column } hover.renderers = glyphs p_world_covid.add_tools(hover) # # Extra formatting # for ax in p_world_covid.yaxis: # ax.axis_label_text_font_style = 'bold' # ax.axis_label_text_font_size = '16pt' # p_world_covid.title.text_font_size = '20pt' # p_world_covid.title.text_font_style = 'italic' glyphs_covid_world = glyphs # %% Make Buttons for state graph """ # %% Make Buttons for state graph ________________________________________________________________________________
line_color="white", line_width=0.1, ) p_map.add_layout(color_bar, 'right') # Add the hover tool to show the state name and number of counties hoverm = HoverTool() hoverm.tooltips = [ ('Name', "@name"), ("Population~", "@population{0,0.}"), #("Current COVID Statistics","{}".format('-'*15)), ('Cases Avg per 100k', "@cases_avg_per_100k{0,0.0}"), ('Deaths Avg per 100k', "@deaths_avg_per_100k{0,0.0}"), ('Cases', "@cases{0,0.}"), ] hoverm.renderers = [ p_map_mpoly ] # only use hovertool for the heatmaps, not the state outlines added below p_map.add_tools(hoverm) # Add the states outline p_statesmap_mpoly = p_map.multi_polygons( xs='x', ys='y', source=source_statesmap, fill_color=None, fill_alpha=0, hover_fill_alpha=0, line_color="white", line_width=1, )