pylab.show() did not work
Question: I run the python code as it is from this website:

<http://cvxopt.org/examples/book/rls.html>

To show it here:

    
    
        # Figure 4.11, page 185.
        # Regularized least-squares.
      ....
        pylab.figure(1, facecolor='w')
        pylab.plot(lbnds, alpha1, 'b-', ubnds, alpha2, 'b-')
        kmax = max([ k for k in range(len(alpha1)) if alpha1[k] <
            blas.nrm2(xls)**2 ])
        pylab.plot( [ blas.nrm2(b)**2 ] + lbnds[:kmax] +
            [ blas.nrm2(A*xls-b)**2 ], [0.0] + alpha1[:kmax] +
            [ blas.nrm2(xls)**2 ], '-', linewidth=2)
        pylab.plot([ blas.nrm2(b)**2, blas.nrm2(A*xls-b)**2 ],
            [0.0, blas.nrm2(xls)**2], 'bo')
        pylab.fill(lbnds[-1::-1] + ubnds + [ubnds[-1]],
            alpha1[-1::-1] + alpha2+ [alpha1[-1]], facecolor = '#D0D0D0')
        pylab.axis([0, 15, -1.0, 15])
        pylab.xlabel('||A*x-b||_2^2')
        pylab.ylabel('||x||_2^2')
        pylab.grid()
        pylab.title('Regularized least-squares (fig. 4.11)')
        pylab.show()
    

it is supposed to show the plot after I run `python rls.py` . But nothing
appear, any help? Thank you


Answer: You need to enable an interactive backend to get a plot viewer window when
using `pylab.show()`. The 'agg' backround is non-interactive (although there
are interactive backends based on Agg, e.g. TkAgg, Qt5Agg).

You have a few options, but the simplest option for MacOS X is the 'macosx'
backend. You can enable this by using the following at the top of your script:

    
    
    import matplotlib
    matplotlib.use('macosx')
    

