A help(imshow) will find the aspect argument, which after a little experiment seems to give what you want (a square image of a spiral, but with an x โโscale of -4 to 4 and y from -1 to 1) when used as follows:
imshow(z, origin='lower', extent=[-4,4,-1,1], aspect=4)
But now your plot is still from -1 to 1, so you will also have to change this ...
plot(x[:]*4, z[50, :])
I think that when you have a few elements that need to be changed, simply using single-line titration with re-labeling will not be redundant:
xticks(xticks()[0], [str(t*4) for t in xticks()[0]])
weronika
source share