title: Plotly-Dash: Want two stacked bar charts side by side from single df column
body: <p>I am trying to get two stacked bar charts side by side but cannot figure it out.</p>
  
  <p>Here's an example df:</p>
  
  <pre><code>Field       Issue
  
  Police      Budget cuts
  Research    Budget cuts
  Police      Time consuming
  Banking     Lack of oversight
  Healthcare  Lack of support
  Research    Bureaucracy
  Healthcare  Bureaucracy
  Banking     Mistrust
  </code></pre>
  
  <p>What I want is a stacked bar chart of of field first. It will have a height of 8 broken down by 2 police, 2 x research etc. Then I want a stacked bar chart of Issue next to the first chart. This second one will have a height of 8 and be stacked by 2 x budget cuts, 1 x time consuming, 1 x lack of oversight etc.</p>
  
  <p>I have tried:</p>
  
  <p>to get the stacked bar chart of all fields:</p>
  
  <pre><code>trace1 = go.Bar(
      x = df.Field.unique(),
      y = df.Field.value_counts(),
      name='Total Amount of roles'
  )
  </code></pre>
  
  <p>to get a stacked bar chart of Budget cuts (then replicate for other issues):</p>
  
  <pre><code>trace2 = go.Bar(
      x = df.Field.unique(),
      y = df[df['Issue'] == 'Budget cuts'].Field.value_counts(),
      name='Budget cuts'
  )
  
  data = [trace1, trace2]
  layout = go.Layout(barmode='stack')
  
  fig = go.Figure(data=data, layout=layout)
  py.plot(fig, filename='test.html')
  </code></pre>
  
  <p>But the above code stacks the two graphs onto one. I want trace 1 stacked and trace 2 stacked. I also want this integrated into Dash and not plotly on it's own but that would be secondary to be honest. Would appreciate any help!</p>