allow change of png DPI in inline backend #957

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+6 −6
Split
@@ -100,9 +100,7 @@ def print_figure(fig, fmt='png'):
fig.set_edgecolor('white')
try:
bytes_io = BytesIO()
- # use 72 dpi to match QTConsole's dpi
- fig.canvas.print_figure(bytes_io, format=fmt, dpi=72,
- bbox_inches='tight')
+ fig.canvas.print_figure(bytes_io, format=fmt, bbox_inches='tight')
data = bytes_io.getvalue()
finally:
fig.set_facecolor(fc)
@@ -38,18 +38,20 @@ def _config_changed(self, name, old, new):
# 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. This is configurable via Global.pylab_inline_rc,
- # or rather it will be once the zmq kernel is hooked up to
- # the config system.
+ # make that fit.
rc = Dict({'figure.figsize': (6.0,4.0),
# 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."""
)
+
figure_format = CaselessStrEnum(['svg', 'png'], default_value='png', config=True,
help="The image format for figures with the inline backend.")