To complete Joe answer, the inlinebackend (IPython/kernel/zmq/pylab/backend_inline.py) have some default matplotlib parameters :
# The typical default figure size is too large for inline use,
# so we shrink the figure size to 6x4, and tweak fonts to
# make that fit.
rc = Dict({'figure.figsize': (6.0,4.0),
# play nicely with white background in the Qt and notebook frontend
'figure.facecolor': 'white',
'figure.edgecolor': 'white',
# 12pt labels get cutoff on 6x4 logplots, so use 10pt.
'font.size': 10,
# 72 dpi matches SVG/qtconsole
# this only affects PNG export, as SVG has no dpi setting
'savefig.dpi': 72,
# 10pt still needs a little more room on the xlabel:
'figure.subplot.bottom' : .125
}, config=True,
help="""Subset of matplotlib rcParams that should be different for the
inline backend."""
)
As this is not obvious to everyone, you can set it in config through c.InlineBackend.rc
.
[Edit] precise info about configurability.
IPython have the particularity that most of the classes have properties which default values can be configured. Those are often refered as Configurable
(uppercase C), those property can easily be recognize in the code as they are declared like so before __init__
:
property = A_Type( <default_value>, config=True , help="a string")
You can overwrite those properties in IPython configuration files (which one depends on what you want to do) by doing
c.ClassName.propertie_name = value
Here as it is a dict you could do
#put your favorite matplotlib config here.
c.InlineBackend.rc = {'figure.facecolor': 'black'}
I guess an empty dict would allow inline backend to use matplotlib defaults.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…