From: John H. <jdh...@ac...> - 2005-02-19 21:55:39
|
>>>>> "Darren" == Darren Dale <dd...@co...> writes: Darren> I like the new matshow function. Is it possible to update Darren> the data? I was looking for the equivalent of an imshow Darren> object's set_data method, but it is not exposed to Darren> matshow. matshow returns the image object, so you should be able to call set_data on this instance. Of course, the new array needs to have the same aspect ratio as the original if you want the aspect preserving features of matshow. Darren> This is a nice function for plotting microscopy images, Darren> since the aspect ratio is fixed. Is there any object to Darren> allowing the origin kwarg to do reorient the origin of the Darren> image? -- I don't think so. Take a look at the implementation of matshow in pylab.py. It is broken into two pieces. The hard part is being done in matplotlib.figure.figaspect, which creates the figure with the right aspect ratio -- as long as you create an axes with equal width and height, your axes will have the right aspect too. You can use this figaspect yourself, and then simply call imshow with the args you want. from matplotlib.figure import figaspect w,h = figaspect(arr) fig = figure(figsize=(w,h)) ax = fig.add_axes([0.15, 0.09, 0.775, 0.775]) ax.imshow(arr, origin='upper', interpolation='nearest') JDH |