If I want to plot the curve of a function, say 1/x, between 0.1 and 10, I can do it like this:
xx = np.linspace(0.1,10,1000)yy = 1.0/xxplt.plot(xx,yy)
The problem is that the spacing between points is not balanced along the curve. Specifically, at the left of the curve, where x<y, the points are very sparse (only about 10% of the points are there), and at the right of the curve, where x>y, the points are much denser (about 90% of the points are there, even though the curve is symmetric in both parts).
How can I create the arrays xx
and yy
(in general, not only for this particular function) such that the spacing between adjacent points is similar throughout the entire curve?