PatrikHlobil / Pandas-Bokeh

Bokeh Plotting Backend for Pandas and GeoPandas
MIT License
878 stars 112 forks source link

how to update data + is the datasource from plot_bokeh acessible? #111

Closed ghomem closed 3 years ago

ghomem commented 3 years ago

Hi,

I am using plot_bokeh to render a plot based on a GeoDataFrame counties as rows, to which an 'incidence' column has been added:

https://coviz.io/#section3

and it works great.

This incidence column is updated as a function of a slider change.

I have a difficulty concerning the method of updating the plot everytime the slider is changed: because the datasource is not accessible I didn't find a way to update the plot other than generating a new one and inserting it into the layout. This works, but it is rather CPU consuming and causes a ~5 seconds lag.

Any suggestion?

ghomem commented 3 years ago

This should do it:

https://github.com/ghomem/coviz/commit/70036c68e0c241d66585c770f811958981e3eb3a

but in reality, even though it seems that I am updating the data_source, it does not make the plot change. Does not seem to be much faster either.

ghomem commented 3 years ago

This actually works:

https://github.com/ghomem/coviz/pull/3/files

but it ain't faster than what I originally had. Any ideas? Thanks in advance :-)

ghomem commented 3 years ago

Found a way to make it work very fast:

https://github.com/ghomem/coviz/pull/4/

However the tooltips are not updating (they keep the old values).

ghomem commented 3 years ago

Well, after some hair pulling I managed to solve this. The details are here:

https://discourse.bokeh.org/t/performance-on-geoplot-how-to-reach-datasource/8211/2

final PR:

https://github.com/ghomem/coviz/pull/5/files