title: Setting Different Bar color in matplotlib Python
body: <p>Supposely, I have the bar chart as below:</p>
  
  <p><img src="https://i.stack.imgur.com/wy1lP.png" alt="BarPlot"></p>
  
  <p>Any ideas on how to set different colors for each carrier? As for example, AK would be Red, GA would be Green, etc?</p>
  
  <p>I am using Pandas and matplotlib in Python</p>
  
  <pre><code>&gt;&gt;&gt; f=plt.figure()
  &gt;&gt;&gt; ax=f.add_subplot(1,1,1)
  &gt;&gt;&gt; ax.bar([1,2,3,4], [1,2,3,4])
  &lt;Container object of 4 artists&gt;
  &gt;&gt;&gt; ax.get_children()
  [&lt;matplotlib.axis.XAxis object at 0x6529850&gt;, &lt;matplotlib.axis.YAxis object at 0x78460d0&gt;,  &lt;matplotlib.patches.Rectangle object at 0x733cc50&gt;, &lt;matplotlib.patches.Rectangle object at 0x733cdd0&gt;, &lt;matplotlib.patches.Rectangle object at 0x777f290&gt;, &lt;matplotlib.patches.Rectangle object at 0x777f710&gt;, &lt;matplotlib.text.Text object at 0x7836450&gt;, &lt;matplotlib.patches.Rectangle object at 0x7836390&gt;, &lt;matplotlib.spines.Spine object at 0x6529950&gt;, &lt;matplotlib.spines.Spine object at 0x69aef50&gt;, &lt;matplotlib.spines.Spine object at 0x69ae310&gt;, &lt;matplotlib.spines.Spine object at 0x69aea50&gt;]
  &gt;&gt;&gt; ax.get_children()[2].set_color('r') #You can also try to locate the first patches.Rectangle object instead of direct calling the index.
  </code></pre>
  
  <p>For the suggestions above, how do exactly we could enumerate ax.get_children() and check if the object type is rectangle? So if the object is rectangle, we would assign different random color?</p>