Why the frame area drawed by the pyplot is black?
Question: My test codes are

    
    
    import numpy as np
    import time
    import matplotlib
    from matplotlib import pyplot as plt
    
    def run(genxy, style='point'):
        fig, ax = plt.subplots(1, 1)
        #ax.set_aspect('equal')
        ax.set_xlim(0, 5.2)
        ax.set_ylim(-1.1, 1.1)
        ax.hold(True)
    
        plt.show(False)
        plt.draw()
    
        background = fig.canvas.copy_from_bbox(ax.bbox)
    
        x, y = genxy.next()
        if style == 'point':
            sincurve = ax.plot(x, y, '.')[0]
        else:
            sincurve = ax.plot(x, y)[0]
    
        while True:
            try:
                x, y = genxy.next()
            except StopIteration:
                break
            sincurve.set_data(x, y)
            # restore background
            fig.canvas.restore_region(background)
            # redraw just the points
            ax.draw_artist(sincurve)
            # fill in the axes rectangle
            fig.canvas.blit(ax.bbox)
            time.sleep(0.1)
    
        plt.close(fig)
    
    from copy import copy
    X = np.arange(0, 5, 0.1)
    
    def generate_curve(x):
        x = copy(x)
        y = np.sin(x)
        for i in range(0, len(y)):
            yield x[0:i+1], y[0:i+1]
    genxy = generate_curve(X)
    run(genxy, 'line')
    

And the screenshot image is

[![enter image description
here](http://i.stack.imgur.com/Q8sFO.png)](http://i.stack.imgur.com/Q8sFO.png)

And more there is a warning printed out

> QGtkStyle could not resolve GTK. Make sure you have installed the proper
> libraries.

My python is 2.7, my system is LMDE2(Linux Mint Debian Edition 2).


Answer: Have a look in your `matplolibrc` file - this contains all the plotting
defaults. On my Windows system it's here:  
`C:\Python27\Lib\site-packages\matplotlib\mpl-data\matplotlibrc`

You should have a line like this:  
`#figure.facecolor : 0.75 # figure facecolor; 0.75 is scalar gray`

On my system if I un-comment this and change `0.75` to `0.0`, I get a black
frame with your code, otherwise it's grey as it should be.

If the the line is not un-commented then I don't know where your black is
coming from. Adding the line `matplotlib.rc('figure', facecolor='0.75')`
immediately after your imports should hopefully fix the problem, but doesn't
answer where the black has come from if not from your `matplotlibrc` file

Edit: [this](https://bbs.archlinux.org/viewtopic.php?id=99175) link may help
you solve the GTK problem.

