From: Yagua R. <yag...@gm...> - 2010-01-14 17:37:03
|
I use matplotlib since two days only. I have done some things pretty good but I am now in front of a problem an I didn't found a solution in the documentation. I would like to draw the surface defined by the lists X, Y and the matrix Z. I get to a nice graphical output with the following code. My problem is that the labels on the axes indicate values corresponding to the indices in Tables X and Y or something like that. I would like to see the values between xmin and xmax, ymin and ymax. If I uncomment the lines set_xlim and set_ylim, the axes are properly represented, but the picture is shrinked into a corner. How to put the good values on the axes and correct the image full screen and correct scale ? Thank you in advance. #! /usr/bin/env python from pylab import * x=[0,1,2,3] y=[12, 32,81] z=[2,3,1,4,2,5,6,8,10,4,11,3] Z=zeros((len(x),len(y))) count=0 for i in range(0,len(x)): for j in range(0,len(y)): Z[i,j]=z[count] count=count+1 ax = subplot(111) im = imshow(Z, interpolation='bilinear') xmin=x[0] xmax=x[len(x)-1] ymin=y[0] ymax=y[len(y)-1] #ax.set_xlim(xmin,xmax) #ax.set_ylim(ymin,ymax) #axes().set_aspect('auto',adjustable='box') colorbar() show() |