[IPython-dev] notebook questions an aesthetic details

MinRK benjaminrk at gmail.com
Sun Feb 5 15:37:37 EST 2012


On Sun, Feb 5, 2012 at 12:21, Chris Kees <cekees at gmail.com> wrote:

> Hi,
>
> 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}...)?
>

Yes, if you are using master it's just:

    from IPython.core.display import *
    Latex("\begin{eqnarray}...\end{eqnarray}")

In 0.12, Math will do the same thing, but we want Math to really mean
'single expression', so it now ensures that expressions are wrapped in '$'.



>  - I'd like to make my plots bigger. Do I do that from matplotlib or the
> notebook?
>

This is handled entirely by matplotlib.  You change the size of figures
just like you always have done in matplotlib:

    matplotlib.rcParams['figure.figsize'] = [x,y]

Or with the IPython helper function:

    figsize(x,y) # in the global namespace when inline backend is in use,
which does the same thing.


> - 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.
>

Matplotlib - changing anything about the figure appearance will always be
handled by matplotlib.  All IPython does is print the figure to a
particular format, and send it to the frontend.  Matplotlib determines
(almost) everything about the contents of that image.


> - My plots appear to be bitmaps, can I make the default SVG?
>

They are PNG by default, and you can change the figure format with the
InlineBackend.figure_format configurable:

    c.InlineBackend.figure_format = 'svg' # in a config file

or

    %config InlineBackend.figure_format = 'svg'

from an interactive session to toggle it at runtime (you can keep changing
it back and forth, if you have any reason to do this).

I think SVG figures behave a bit differently with respect to size in
browsers, but I don't recall.


> - 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.
>

Yes, simply close the figure before the end of the cell, and it won't be
displayed:

    fig = gcf()
    plot(x,y)
    # dostuff with figure

    # close figure at end of cell, to prevent display
    plt.close(fig)

-MinRK


>
> Thanks,
> Chris
>
>
>
> _______________________________________________
> 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/20120205/d54c42d0/attachment.html>


More information about the IPython-dev mailing list