title: d3.js force directed interactive coloring for groups
body: <p>I'm working from <a href="https://bl.ocks.org/mbostock/4062045" rel="nofollow noreferrer">this example</a> of a D3.js force-directed graph. The example colors the nodes according to their group membership for one set of groups. I have this working fine with my data. However, my data can be grouped on multiple node attributes (e.g. by gender or by party affiliation). The simple solution is to simply make separate graphs, each colored according to a different attribute. </p>
  
  <p>Is there a way to have the color scheme be interactive (rather than hard coded)? Will D3 let me add a drop down or button to pick which attribute (gender, affiliation...) is used to color the nodes? <a href="https://stackoverflow.com/questions/18334704/adding-and-removing-nodes-and-links-from-force-diagram-in-d3-based-on-filter-dro">This code</a> lets a user interactively filter their data using a drop down menu, but I'm not sure how I might go from that to interactively picking attributes to use for colors.</p>