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>

<p>The problem of getting right xticks was solved <a href="http://stackoverflow.com/a/22623488/6845924">here</a>.</p>

<blockquote>
  <p>However, if you <em>really</em> need bars or you <em>really</em> want everything on
  the same twin x-axes, then you have to plot with matplotlib's API like
  this:</p>

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

fig, tsax = plt.subplots(figsize=(12,5))
barax = tsax.twinx()

data = pd.DataFrame(np.random.randn(10,3), columns=list('ABC'), index=pd.DatetimeIndex(freq='1M', start='2012-01-01', periods=10))
data['A'] **= 2

# the `width` is specified in days -- adjust for your data
barax.bar(data.index, data['A'], width=5, facecolor='indianred')

barax.set_ylabel('Miles')
tsax.set_ylabel('Miles/Gallon')

barax.xaxis.tick_top()

fig.tight_layout()

tsax.plot(data.index, data['B'])
tsax.plot(data.index, data['C'])
</code></pre>
  
  <p>Which then gives me <a href="http://i.stack.imgur.com/jHOHW.png" rel="nofollow">http://i.stack.imgur.com/jHOHW.png</a></p>
</blockquote>

python pandas matplotlib plot