I'm making a trend graph with Bokeh, showing how the popularity of concepts came and went with time. I used the brewer example (https://docs.bokeh.org/en/latest/docs/gallery/stacked_area.html). Only the tooltip doesn't really display what I want it to.
I adapted the bottom 6 lines like this:
source = ColumnDataSource(data=dict( x=[x2] * len(areas), y=[areas[y] for y in categories], name=categories, )) timesteps = [str(x.date()) for x in pd.date_range('1950-01-01', '1951-07-01', freq='MS')] p = figure(x_range=FactorRange(factors=timesteps), y_range=(0, 800), tools="hover") p.xaxis.major_label_orientation = np.pi/4 p.grid.minor_grid_line_color = '#eeeeee' hover = p.select(dict(type=HoverTool)) hover.tooltips = [ ('Name', ' @name'), ('Time', ' $x'), ('Count', ' @count'), ] p.patches('x', 'y', source=source, color=colors, alpha=0.8, line_color=None) output_file("brewer.html", title="brewer.py example") show(p) The first two lines of the tooltip work, displaying the name (y0, y1, y2...) and the date; only the third line I can't figure out. I want to display the "height" of the data point at that time, i.e. if I had a dictionary like
{'y0': {'1950-01-01': '3', '1950-02-01': '5', '1950-03-01': '6'}, 'y1': {'1950-01-01': '10', '1950-02-01': '15', '1950-03-01': '14'}} and so on, I would like to display at each point the popularity of a y at a given point in time. That popularity is already displayed graphically, but to make it more obvious, I would also like to make the number that was plotted available - I only don't know how. I've tried building different dictionaries and lists, but only succeeded in displaying one number for every point in time for every concept, but that number didn't change.