[IPython-dev] Notebook: Horizontal layout for multiple figures in output cell
Sat Feb 22 16:17:35 CST 2014
I have a very similar workflow and agree that plotting and arranging
figures is not as easy or flexibe as it could be. However, my approach
is slightly different: All my plots are subplots. I usually define
each subplot in a separate function that takes Axes as an argument
(this could be extended to directly create a new figure if no axes
argument is passed). I then create a figure with a number of columns
and rows and attach the previously defined subplots in a convenient
order. I usually iterate the defined subplots and the arrangement of
the subplots until I am happy with the figure.
It should be easier to rearrange (sub)plots, but I am not sure if the
IPython notebook / HTML is the right place to do it. If matplotlib
would make this more convenient this might be all we need.
I just played around with moving / copying axes (subplots) between
figures in matplotlib and while I think it's supposed to work and
works to some extend, it does not work properly (e.g. size, position,
axes of the subplots are wrong when reattached to a different figure).
On Fri, Feb 21, 2014 at 11:41 AM, Antonino Ingargiola
> Hi Patrick,
> thanks for your input.
> Yes I'm using matplotlib.
> I know very well the different (and excellent!) options for creating
> In my workflow, as common in scientific computing, the analysis is
> "evolving". I need to try several routes before I find the right way. So I
> want to make this process as smooth as possible.
> In this use case I value simplicity over everything else. For example when I
> plot a series of plots I need to scale the subplots if the number of plots
> changes (otherwise the plots becomes smaller, labels overlaps an so on).
> Moreover with separate figures I'm "ready" to save "the good one" with a
> savefig. Also, oftentimes I send my notebooks to non-python developers (read
> PI), and if I use the most basic matlab-like interface they can follow the
> code. When I start to mess with lists of axes, dynamic resizes, etc.., the
> code become more difficult to follow, for no good reason. As I said, using
> multiple figures is just too convenient in some use-cases. It's just
> annoying, in my case, that the figures stack vertically, and I would like
> the option to change this.
> I think this may be a common enough scenario to grant an IPython
> config/option/plugin to achieve it.
> Any suggestion is welcome...
> On Fri, Feb 21, 2014 at 10:13 AM, Patrick Surry <firstname.lastname@example.org>
>> 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
>> 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
More information about the IPython-dev