environment/lib/python2.7/site-packages/IPython/core/pylabtools.py
def print_figure(fig, fmt='png'):
    """Convert a figure to svg or png for inline display."""
    # When there's an empty figure, we shouldn't return anything, otherwise we
    # get big blank areas in the qt console.
    if not fig.axes and not fig.lines:
        return

    fc = fig.get_facecolor()
    ec = fig.get_edgecolor()
    fig.set_facecolor('white')
    fig.set_edgecolor('white')
    try:
        bytes_io = BytesIO()
        fig.canvas.print_figure(bytes_io, format=fmt, bbox_inches='tight')
        data = bytes_io.getvalue()
    finally:
        fig.set_facecolor(fc)
        fig.set_edgecolor(ec)
    return data
def print_figure(fig, fmt='png'):
    """Convert a figure to svg or png for inline display."""
    # When there's an empty figure, we shouldn't return anything, otherwise we
    # get big blank areas in the qt console.
    if not fig.axes and not fig.lines:
        return

    fc = fig.get_facecolor()
    ec = fig.get_edgecolor()
    fig.set_facecolor('white')
    fig.set_edgecolor('white')
    try:
        bytes_io = BytesIO()
        fig.canvas.print_figure(bytes_io, format=fmt, bbox_inches='tight')
        data = bytes_io.getvalue()
    finally:
        fig.set_facecolor(fc)
        fig.set_edgecolor(ec)
    return data
def print_figure ( fig , fmt = 'png' ) : # When there's an empty figure, we shouldn't return anything, otherwise we # get big blank areas in the qt console. if not fig . axes and not fig . lines : return fc = fig . get_facecolor ( ) ec = fig . get_edgecolor ( ) fig . set_facecolor ( 'white' ) fig . set_edgecolor ( 'white' ) try : bytes_io = BytesIO ( ) fig . canvas . print_figure ( bytes_io , format = fmt , bbox_inches = 'tight' ) data = bytes_io . getvalue ( ) finally : fig . set_facecolor ( fc ) fig . set_edgecolor ( ec ) return data
Convert a figure to svg or png for inline display.
Convert a figure to svg or png for inline display .