title: Grouped Bar Chart with grouping in Plotly
body: <p>I am trying to create a grouped bar chart in plotly, but I cannot seem to color my bars within a group(so they are all the same color). Does anyone know how to do this in plotly? I would like to color my barchart according to the SubCategory(so all bars in a sub-category have their own color). I have tried adding traces to a graph, but no luck. Thanks.</p>
  
  <pre><code>sample &lt;- data.frame(
    Category &lt;- c("Furniture","Furniture","Furniture","Furniture",
                  "Office Supplies","Office Supplies", "Office Supplies", "Office Supplies",
                  "Office Supplies", "Office Supplies", "Office Supplies", "Office Supplies",
                  "Office Supplies", "Technology","Technology","Technology","Technology"),
    SubCategory &lt;- c("Bookcases","Chairs","Furnishings","Tables","Appliances","Art","Binders","Envelopes", 
                     "Fasteners","Labels","Paper","Storage",  "Supplies", "Accessories","Copiers","Machines",
                     "Phones"),
    sales &lt;- c(889222.51,920892.65,239840.16,445823.93,614737.91,225594.68,281494.68,104903.88,50156.06,44269.30,
               150113.36,692903.08,152196.19,463383.33,965899.78,458655.43,1005525.38)
  )
  
  #plot code so far
  sample %&gt;%
    plot_ly(
      x = Category,
      y = sales,
      type = "bar",
      group = SubCategory
    )
  </code></pre>
  
  <p>Below is what I have so far, but the coloring is not based on the grouping. When I supply a color variable, it does not color all the bars within the SubCategory the same color. Is this is possible bug?
  <a href="https://i.stack.imgur.com/RHtk4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RHtk4.png" alt="enter image description here"></a></p>