Hello everyone.
I was finally successful in making a choropleth map with a time slider in bokeh. There is only one thing that I would like to improve: Every time I move the slider I have to wait a lot to obtain the new map, and I think that there must be a way to optimize this.
This is how my app looks like:
And this is the code that I wrote in the callback function:
def callback(attr, old, new):
N = slider.value
slider.title = 'Number of Incidences in ' + column_list[N]
p.patches('xs', 'ys', fill_alpha=0.7,
fill_color={'field': column_list[N], 'transform': mapper},
line_color='black', line_width=0.2, source=geo_source)
hover = p.select_one(HoverTool)
hover.point_policy = "follow_mouse"
hover.tooltips = [
("Municipality", "@Municipality"),
("Incidences", "@{" + column_list[N] + "}"),
]
slider.on_change('value', callback)
Basically, every time I move the slider, I read a different column from the column_list. I think that the problem is that I create the patches from scratch every time I move the slider. Is there a way to just change the color?
I also have a second question: is there a way to not show the number next to the slider?
Thanks in advance.
Lefteris