[IPython-dev] Notebook: Horizontal layout for multiple figures in output cell

Jon Wilson jsw at fnal.gov
Fri Feb 21 13:49:32 EST 2014


I often have the same desire as Antonino, for much the same reasons.  
Creating subplots is really not an appropriate solution. The separate 
figures are exactly that, separate figures.  It is semantically 
incorrect to combine them into one figure, and causes additional 
complications when I want to save them to a file (for example if I want 
to include them in a manuscript) -- if I have combined them as subplots, 
then when I want to save them, I must re-separate them.

Antonino, at one point, with a much older (pre 1.0) version of the 
notebook, I found a way to hack the notebook CSS so that output cells 
would float left.  This was a (nearly) perfect solution for me.  
However, I suspect it might not work anymore with newer versions of the 
notebook.  When I updated to a post 1.0 version, I never took the time 
to get it working again.  But perhaps that idea is a starting point for 
you.  Take a look at the HTML structure of the notebook and output 
cells, and then fiddle with the CSS (in whatever way is now appropriate) 
until you get something that works better for you.

Regards,
Jon

On 02/21/2014 12:13 PM, Patrick Surry wrote:
> If you're using matplotlib for your plots, you can use subplots to 
> create a horizontal (or arbitrary grid) of plots in an output cell.
>
> Try this example 
> http://matplotlib.org/examples/pylab_examples/subplot_demo.html
>
> but change plt.subplot(2,1,1) and plt.subplot(2,1,2) (which indicate a 
> 2x1 grid and plot #1 and #2) to plt.subplot(1,2,1) and 
> plt.subplot(1,2,2) which does the same in a 1x2 grid.
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140221/ccf05039/attachment.html>


More information about the IPython-dev mailing list