For the purpose of building graphics, there is no need for adaptive sampling. Why not just select an image with a screen resolution or higher?
POINTS=1920 from pylab import * x = arange(0,1,1.0/POINTS) y = sin(3.14*x) plot(x,y) axes().set_aspect('equal')
If you need an arbitrary sample density or if the function is incompatible with vectorized approaches, you can create an x, y array by points. Intermediate values will be linearly interpolated by the plot() function.
POINTS=1980 from pylab import * ax,ay = [],[] for x in linspace(0.0,POINTS,POINTS): if randint(0,50)==0 or x==0 or abs(x-POINTS)<1e-9: y = math.sin(4*2*math.pi*x/POINTS) ax.append(x), ay.append(y)
nobar source share