From: Fernando P. <Fer...@co...> - 2005-03-16 19:28:45
|
John Hunter wrote: >>>>>>"James" == James Boyle <bo...@ll...> writes: > > > James> How would one get a colorbar() with a matshow plot? That > James> is without altering the matshow code in pylab.,py. > > A good question. The naive answer is: add the gci._current line to > the matshow code below the imshow line > > im = ax.imshow(*args,**kw) > gci._current = im > > > and then do > > In [1]: matshow(rand(12,12)) > In [2]: colorbar() > > The problem, of course, is that colorbar resizes the current axes, > which defeats the purpose of matshow. > > What one needs is a colorbar kwarg to the matshow function that makes > extra room for the colorbar and still preserves the aspect ratio. > This would require some arithmetic and extra work. Any takers? Well, I've been wanting this (I mentioned it to you in SF in passing) for a while. But I don't know the sizing code well enough to be able to write it up quickly. I'm just not terribly comfortable yet with the overall internal design of mpl. If nobody else does it I probably will, because I need it. But it will likely be _weeks_ before I even have a look. best, f |