I want to plot a curve on an image. I would to see the curve only in a certain range. So:
plt.figure()
plt.imshow(img)
plt.plot(x, my_curve)
plt.axis([0, X, Y, 0])
But in this way also the image is showed in that range, but I don't want this. I would like to see the whole image with a portion of the curve. How can apply the axes only on the second plot?
EDIT: I can't use a slice of the arrays. I am in this case (it is an example):
x = [0 0 0 10 10 10 30 30 30 40 40 40]
my_curve = [0 0 0 10 10 10 30 30 30 40 40 40]
Well I need to see the straight line only between 25 and 35. If I delete each element out of such range, I obtain only the point (30,30).
xandmy_curveinplt.plot(x, my_curve)to something likeplt.plot(x[:X], my_curve[:X])?Xinx(we'll call itX_idx) and then doplt.plot(x[:X_idx], my_curve[:X_idx]).