how to handle an asymptote/discontinuity with Matplotlib
By using masked arrays you can avoid plotting selected regions of a curve. To remove the singularity at x=2: import matplotlib.numerix.ma as M # for older versions, prior to .98 #import numpy.ma as M # for newer versions of matplotlib from pylab import * figure() xx = np.arange(-0.5,5.5,0.01) vals = 1/(xx-2) vals = M.array(vals) mvals … Read more