I have written a function module that takes the argument of two variables. To plot, I had
x, y = pylab.ogrid[0.3:0.9:0.1, 0.:3.5:.5]
z = np.zeros(shape=(np.shape(x)[0], np.shape(y)[1]))
for i in range(len(x)):
for j in range(len(y[0])):
z[i][j] = fancyFunction(x[i][0], y[0][j])
pylab.imshow(z, interpolation="gaussian")
The image I get is the following:
But when I tried rescaling the x and y axis to match the ranges of [0.3:0.9:0.1, 0.:3.5:.5] thru pylab.imshow(z, interpolation="gaussian", extent=[.3,.9,0.,3.5])
I get
I've been googling for hours but still couldn't find a way to make a square plot with differently scaled axis.
Thanks!
Just specify vmin=0, vmax=1 . By default, imshow normalizes the data to its min and max. You can control this with either the vmin and vmax arguments or with the norm argument (if you want a non-linear scaling).
This example displays the difference between interpolation methods for imshow . If interpolation is None, it defaults to the rcParams["image. interpolation"] (default: 'antialiased' ). If the interpolation is 'none' , then no interpolation is performed for the Agg, ps and pdf backends.
Use the aspect
argument:
pylab.imshow(z, interpolation="gaussian", extent = [.3,.9,0.,3.5], aspect='auto')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With