Outputting two graphs at once using matplotlib
<p>In short, I want to write a function that will output a <a href="http://pandas.pydata.org/pandas-docs/version/0.15.0/visualization.html#visualization-scatter-matrix" rel="nofollow">scatter matrix</a> and <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.boxplot.html" rel="nofollow">boxplot</a> at one time in python. 
I figured I would do this by created a figure with a 2x1 plotting array. However when I run the code using a Jupyter notebook: </p>

<pre><code>def boxplotscatter(data):
    f, ax = plt.subplots(2, 1, figsize = (12,6))
    ax[0] = scatter_matrix(data, alpha = 0.2, figsize = (6,6), diagonal = 'kde')
    ax[1] = data.boxplot()
</code></pre>

<p>I get, using data called <code>pdf</code>: </p>

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

<p>That isn't exactly what I expected -- I wanted to output the scatter matrix and below it the boxplot, not two empty grids and a boxplot embedded in a scatter matrix. </p>

<p>Thoughts on fixing this code?</p>

<p>The issue here is that you are not actually plotting on the created axes , you are just replacing the content of your list <code>ax</code>.
I'm not very familiar with the object oriented interface for matplotlib but the right syntax would look more like <code>ax[i,j].plot()</code> rather than <code>ax[i] = plot()</code>.
Now the only real solution I can provide is using functional interface, like that :</p>

<pre><code>def boxplotscatter(data):
    f, ax = plt.subplots(2, 1, figsize = (12,6))
    plt.subplot(211)
    scatter_matrix(data, alpha = 0.2, figsize = (6,6), diagonal = 'kde')  
    plt.subplot(212)
    data.boxplot()
</code></pre>

python matplotlib jupyter-notebook