From: Suresh P. <sto...@ya...> - 2007-03-09 17:55:16
|
I guess I didn't read the following carefully: "... The aspect ratio of the figure window is that of the array ... Because of how matshow() tries to set the figure aspect ratio to be the one of the array, ..." which would explain the behaviour below. Why the restrictions? Seems one would want to put colorbars, etc in the same figure and so why not behave like imshow() which it calls to make the output. And why the new figure (so no possibility of subplots or overlays)? Just curious ... I guess I will use imshow() directly and modify the axes as suggested before to get the output looking like matshow() Cheers, Suresh On Thu, 8 Mar 2007, Suresh Pillai wrote: > If one inserts a colorbar after using matshow, then the matrix plot's aspect > ratio is incorrect altered. Here are 2 cases to compare > > import pylab > matrix = pylab.rand(30,30) > > 1) matshow() before colorbar() > > pylab.matshow(matrix) > pylab.colorbar() > pylab.show() > > The matrix plot is squished in the x-direction while not in the y thus losing > its proper aspect ratio (equal by default). > > 2) imshow() before colorbar() > > pylab.imshow(matrix) > pylab.colorbar() > pylab.show() > > Everthing is okay in this case. > > > Thanks, > Suresh > > |