Performance on Geoplot + how to reach datasource?

Hi,

I am using pandas-bokeh to plot geospatial data that has different values every day. The result is here

http://localhost:8000/coviz#section3

and works, but it is rather slow and I am not sure how to improve it.

One problem might be that plot_bokeh creates a data source internally and we can’t reach it from the oud side. Or can we?

The callback for updating the map is creating a new map at each call, which is kind of expensive server side:

Any suggestions?

Thank you :slight_smile:

Just to comment that this problem is solved. For the record:

  1. the data source of a plot created with plot_bokeh can be fetched from the plot if we create it with a name
  1. it can be kept handy
  1. and updated on a callback:

Thank you,

@ghomem you got to a solution before I could reply, but this is basically what I was going to suggest, an also what is demonstrated consistently thoughout the docs and examples. Just for completeness I will mention that Bokeh content is an object graph, so you can always reach any and every object, e.g. by trawling through plot.renderers and looking for what you need. But there are also query functions like Document.select and others that can be used to search for specific objects, e.g. by their type (ColumnDataSource) or if you configure the object with a name that could be used. You can code-grep the examples repo to see instances of that usage.

Hi @Bryan ,

Thanks for revewing and confirming.

This was not trivial to find in part because the data source is created inside plot_bokeh which is a rather complex function. After I understood how to get the data source from the plot, by looking at that code I managed to understand that the particular data source column that needed update is called “Colormap”. And in order to fill that colum with the repeated index values that arise from the transformation of GeoDataFrame with Polygons to a Pandas Data frame with “patches”, I had to run the convert_geoDataFrame_to_patches which I also found inside plot_bokeh.

Well, problem solved :slight_smile:

thanks for the support,
Gustavo

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.