Tap Tool Multiple Select

def graph_scatter(self, df, df_coord, update_data):

   scatter_source = ColumnDataSource(self.create_scatter_source(df, df_coord, ['Location']))

   # create map
   map_options = GMapOptions(lat=39.82, lng=-98.57, map_type="roadmap", zoom=4)

   scatter = GMapPlot(plot_width=1200, plot_height=800,
     x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options,
     api_key='#########################'
   )

   circle_unselected = Circle(x='lon', y='lat', size='diameter', fill_color='Blue', fill_alpha=0.6, line_color='color',name = "circle")
   circle = Circle(x='lon', y='lat', size='diameter', fill_color='color', fill_alpha=0.6, line_color='color',name = "circle")

   
   if(update_data != None):
  df = df.loc[df['Location'].isin(update_data)]
     df_unselected = df.loc[-df['Location'].isin(update_data)]
     scatter_source_unselected = ColumnDataSource(self.create_scatter_source(df_unselected, df_coord, ['Location']))
     scatter.add_glyph(scatter_source_unselected, circle_deselected, name="circle")
   r = scatter.add_glyph(scatter_source, circle,name="circle")

   return scatter, r

graph,r  = make_graph(df,df_coord,None)
show(graph)

#when a circle is clicked on go to update
r.data_source.on_change('selected',update)
···

update(attr, old, new):
#creates a list of adjacent circles and sends it to graph_scatter

   graph_scatter(self, df, df_coord, update_data)

``

The problem that I’m having is that the graph isn’t updating. Is there a way to select multiple glyphs instead of just the one that is clicked on?

Hi,

I'm not really sure what you are trying to accomplish, maybe you can briefly describe your intent in plain language? I will say that it is often much better to *update* a data source, by setting its .data attrbute, rather than *replacing* a data source entirely. All of the examples, etc. demonstrate this technique.

Thanks,

Bryan

···

On Dec 9, 2016, at 12:32 PM, Rob Pritchard <[email protected]> wrote:

def graph_scatter(self, df, df_coord, update_data):

   scatter_source = ColumnDataSource(self.create_scatter_source(df, df_coord, ['Location']))

   # create map
   map_options = GMapOptions(lat=39.82, lng=-98.57, map_type="roadmap", zoom=4)

   scatter = GMapPlot(plot_width=1200, plot_height=800,
     x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options,
     api_key='#########################'
   )

   circle_unselected = Circle(x='lon', y='lat', size='diameter', fill_color='Blue', fill_alpha=0.6, line_color='color',name = "circle")
   circle = Circle(x='lon', y='lat', size='diameter', fill_color='color', fill_alpha=0.6, line_color='color',name = "circle")

   if(update_data != None):

      df = df.loc[df['Location'].isin(update_data)]
     df_unselected = df.loc[-df['Location'].isin(update_data)]
     scatter_source_unselected = ColumnDataSource(self.create_scatter_source(df_unselected, df_coord, ['Location']))
     scatter.add_glyph(scatter_source_unselected, circle_deselected, name="circle")
   r = scatter.add_glyph(scatter_source, circle,name="circle")

   return scatter, r

graph,r = make_graph(df,df_coord,None)
show(graph)

#when a circle is clicked on go to update
r.data_source.on_change('selected',update)

#
update(attr, old, new):
   #creates a list of adjacent circles and sends it to graph_scatter
   graph_scatter(self, df, df_coord, update_data)

The problem that I'm having is that the graph isn't updating. Is there a way to select multiple glyphs instead of just the one that is clicked on?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/99e3f926-54ce-4f9d-93ed-5677901aaef3%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.