matplotlib two charts side-by-side with third overlying the second chart
Question: I am trying to use matplotlib (more specifically the plot method from pandas)
to plot two charts side-by-side in an ipython notebook with a third chart
overlying the second chart and using a secondary y axis. However, I have been
unable to get the overlay to work.

Currently this is my code:

    
    
    import matplotlib.pyplot as plt
    %matplotlib inline
    
    fig, axs = plt.subplots(1,2)
    fig.set_size_inches(12, 4)
    
    top10.plot(kind='barh', ax=axs[0])
    top10_time_trend.T.plot(kind='bar', stacked=True, legend=False, ax=axs[1])
    time_trend.plot(kind='line', ax=axs[1], ylim=0, secondary_y=True)
    

I get the side-by-side structure I am looking for, but only the first (top10)
and last (time_trend) plots are visible. My output is below:

[![enter image description
here](http://i.stack.imgur.com/RK0SB.png)](http://i.stack.imgur.com/RK0SB.png)

When plotted separately the unshown plot (top10_time_trend) looks like this

[![enter image description
here](http://i.stack.imgur.com/N4brg.png)](http://i.stack.imgur.com/N4brg.png)

What I am trying to accomplish is something that looks like this, i.e. the
line chart overlaying the stacked bar.

[![enter image description
here](http://i.stack.imgur.com/Qbz89.png)](http://i.stack.imgur.com/Qbz89.png)


Answer: The best method to do this is by creating a third axis say:

    
    
    ax3 = ax[1].twinx()
    

and then

    
    
    top10_time_trend.T.plot(kind='bar', stacked=True, legend=False, ax=ax3)
    

Please let me know if this works for you.

Here you can find an example for the usage of twinx() from matplotlib docs
<http://matplotlib.org/examples/api/two_scales.html>

