Cannot combine bar and line plot using pandas plot() function
<p>I am plotting one column of a pandas dataframe as line plot, using plot() :</p>

<pre><code>df.iloc[:,1].plot()
</code></pre>

<p>and get the desired result:</p>

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

<p>Now I want to plot another column of the same dataframe as bar chart using</p>

<pre><code>ax=df.iloc[:,3].plot(kind='bar',width=1)
</code></pre>

<p>with the result:</p>

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

<p>And finally I want to combine both by</p>

<pre><code>spy_price_data.iloc[:,1].plot(ax=ax)
</code></pre>

<p>which doesn't produce any plot.</p>

<p>Why are the x-ticks of the bar plot so different to the x-ticks of the line plot? How can I combine both plots in one plot?</p>

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

<p>some data</p>

<pre><code>df = pd.DataFrame(np.random.randn(5,2))
print (df)
          0         1
0  0.008177 -0.121644
1  0.643535 -0.070786
2 -0.104024  0.872997
3 -0.033835  0.067264
4 -0.576762  0.571293
</code></pre>

<p>then we create an axes object (ax).  Notice that we pass ax to both plots</p>

<pre><code>_, ax = plt.subplots()

df[0].plot(ax=ax)
df[1].plot(kind='bar', ax=ax)
</code></pre>

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

python pandas matplotlib plot