# [IPython-dev] notebook questions an aesthetic details

Fernando Perez fperez.net at gmail.com
Sun Feb 5 17:47:04 EST 2012

Hey Chris,

On Sun, Feb 5, 2012 at 12:21 PM, Chris Kees <cekees at 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