title: How to click a bubble in a bubble plot to generate a networkX network of that bubble?
body: <p>I have a dataframe like this:</p>
  <pre><code>category source_node  target_node
  cat1  node1  target1
  cat1  node2  target1
  cat1  node2  target2
  cat1  node2  target3
  cat1  node2  target4
  cat2  node3  target1
  cat2  node3  target1
  cat2  node4  target7
  cat2  node6  target7
  </code></pre>
  <p>I want to use dash (or a similar, interactive library) to first draw a bubble plot where each category is a separate bubble (ideally with a size linked to the number of items in the category but I can figure that out after), and then when you click on a bubble, a network is produced based on the source and target nodes in that bubble/category.</p>
  <p>This is a dictionary of each category, and the source and target nodes in each category:</p>
  <pre><code>#A dict of source nodes (called nodes) and target nodes (called targets) that will be linked via edges in a$
  node_list_dict = {'cat1':['node1','node2','target1','target2','target3','target4'],
               'cat2':['node3','node4','node6','target1','target7']}
  </code></pre>
  <p>This is a dictionary of each category, and the location of each bubble in the bubble plot:</p>
  <pre><code>#A dict of categories and the location of the categories in the bubble plot
  node_plot_location_dict = {'cat1':[10,4],'cat2':[3,4]}
  </code></pre>
  <p>This is the code to draw the bubble plot:</p>
  <pre><code>#How to draw the bubble plot
  fig = go.Figure(data=[go.Scatter(
      x = [node_plot_location_dict[i][0] for i in node_plot_location_dict],
      y = [node_plot_location_dict[i][1] for i in node_plot_location_dict],
      mode='markers',
      marker_size=[40, 60, 80])
  ])
  
  fig.show()
  </code></pre>
  <p>And this is the code to draw a network:</p>
  <pre><code>#How to draw the network
  import plotly.graph_objects as go
  import networkx as nx
  import matplotlib.pyplot as plt
  
  dict1 = {'cat1':[{'start':'node1','end':'target1'},
                  {'start':'node2','end':'target1'},
                  {'start':'node2','end':'target2'},
                  {'start':'node2','end':'target3'},
                  {'start':'node2','end':'target4'}]}
  
  G = nx.Graph()
  for pts in dict1['cat1']:
      G.add_edge(pts['start'], pts['end'])
  nx.draw(G)
  plt.show()
  </code></pre>
  <p>Then, once I'm in the network, I want to click on a node in the network which will be a hyperlink to a page. Someone kindly suggested code that could be used for that purpose <a href="https://stackoverflow.com/questions/69456723/networkx-add-hyperlink-to-each-node/69464316#69464316">here</a>.</p>
  <p>I'm struggling to link the bubble plot to a network, so that when i 'press' a bubble in the bubble plot, a network is generated.</p>
  <p>Could someone show me how to piece this code together so that I can use dash to make an interactive bubble plot where clicking on a bubble leads a network based on the items in that bubble?</p>
  <p>Just to mention that I chose these libraries because they're the ones I could figure out a solution in, but I'm open to changing the library used as long as it's in python and can work in jupyter or an interface like dash.</p>