# [IPython-dev] notebook questions an aesthetic details

Eric Firing efiring@hawaii....
Sun Feb 5 16:56:41 CST 2012

On 02/05/2012 12:47 PM, Fernando Perez wrote:
> Hey Chris,
>
> On Sun, Feb 5, 2012 at 12:21 PM, Chris Kees<cekees@gmail.com>  wrote:
>> Having a great time here using the notebook. I just want to tweak a couple
>> of display details and was hoping I could get some pointers:
>>
>> - Is there a way to do multiline equations (i.e. \begin{eqnarray}...)?
>
> Sure! In math output, you can use:
>
> from IPython.core.display import Math, Latex
>
> Latex(r"""
> \begin{eqnarray}
> \dot{x}&  = \sigma(y-x) \\
> \dot{y}&  = \rho x - y - xz \\
> \dot{z}&  = -\beta z + xy
> \end{eqnarray}""")
>
> or in a markdown cell, you can put the same content.  Note that
> there's a small bug right now, requiring that in the markdown cell,
> you add *one* extra \ at the end of the \\ that mark new equation
> entries:
>
> \begin{eqnarray}
> \dot{x}&  = \sigma(y-x) \\\
> \dot{y}&  = \rho x - y - xz \\\
> \dot{z}&  = -\beta z + xy
> \end{eqnarray}
>
> I've filed this one here:
>
> https://github.com/ipython/ipython/issues/1381
>
> but fortunately there's a workaround even now.
>
>> - I'd like to make my plots bigger. Do I do that from matplotlib or the
>> notebook?
>
> You can do it in each notebook:
>
> plt.rcParams['figure.figsize'] = (10,6)  # 10x6 inches
>
> But you can also set it permanently in your notebook config file,
> along with SVG format (question below):
>
> c = get_config()
> c.InlineBackend.figure_format = 'svg'
> c.InlineBackend.rc = {'figure.figsize' : (10,6) }
>
>> - I'd like to make my subplots spread apart even wider than the
>> squeeze=false option to the subplots command. Should I be looking at
>> matplotlib or ipython docs to do that? I can get by with just making
>> multiple plots instead of subplots.
>
> This is a matplotlib thing, look into plt.subplots_adjust().  The
> parameters you're looking for are wspace and hspace.  You can also set
> new permanent values for those in your matplotlib config file if you
> want.
>
>> - My plots appear to be bitmaps, can I make the default SVG?
>
> See above.
>
>> - Is there a way to make a plot not display in the browser? I'm generating
>> an animation that I include via HTML(), but the first frame always shows up
>> as a plot underneath the animation frame
>
> Yup, see this:
>
> f, ax = subplots()
> ax.plot(rand(100))
> f.savefig('foo.png')
> plt.close(f)
> HTML('<img src="files/foo.png" /img>')
>
> ###
>
> The fact that f.close() doesn't exist bugs me a lot, I'm asking on

The problem is that when you use pyplot to create a Figure instance, it
is doing a lot more than just making that instance; it is embedding it
in the whole pyplot machinery.  That's why closing the figure is a
pyplot operation (hence a function), not a method of the Figure
instance.  Of course we could find a way to get around it, but that's
the present state.  You have to use pyplot to make the figure, and to
close it.  I imagine the way to change that might be with a
pyplot.Figure class that would be a subclass of the figure.Figure class.

Eric

>
> Cheers,
>
> f
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev