merge two plot to one graph
<p>I have two dataframe, and I plot both of them.
one is for female and the other for male.</p>

<p><a href="https://i.stack.imgur.com/z7VwO.png" rel="nofollow"><img src="https://i.stack.imgur.com/z7VwO.png" alt="enter image description here"></a></p>

<p>I want merge them in one graph with different color
(since they have same feature)</p>

<p>here are codes</p>

<pre><code>female[feature].plot(kind='bar')
male[feature].plot(kind = "bar")
</code></pre>

<p>feature is the column name of data frame.
the date frame is look likes</p>

<pre><code>          X1  X2  X3 ..... X46
male     100  65  75 ..... 150
female   500  75  30 ..... 350
</code></pre>

<p>I think you can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.plot.bar.html" rel="nofollow"><code>DataFrame.plot.bar</code></a> with transposing <code>DataFrame</code> by <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.T.html" rel="nofollow"><code>T</code></a>:</p>

<pre><code>import pandas as pd
import matplotlib.pyplot as plt

df = pd.DataFrame({
'X2': {'female': 75, 'male': 65}, 
'X46': {'female': 350, 'male': 150}, 
'X1': {'female': 500, 'male': 100}, 
'X3': {'female': 30, 'male': 75}})
print (df)
         X1  X2  X3  X46
female  500  75  30  350
male    100  65  75  150

df.T.plot.bar()
plt.show()
</code></pre>

<p><a href="https://i.stack.imgur.com/0XCLw.png" rel="nofollow"><img src="https://i.stack.imgur.com/0XCLw.png" alt="graph"></a></p>

python pandas matplotlib plot dataframe