Great, matshow() works for my requirements.

Although, I must comment that its placement of tickbars seems 
inappropriate for a matrix visualisation.  For example, for the following 
simple example:

import pylab

matrix = pylab.array([[1,2,3],[4,5,6],[1,1,4]])
pylab.matshow(matrix, cmap=pylab.cm.gray)
pylab.show()

tick marks and labels are produced for [0.5,1.5,2.5] in addition to the 
appropriate integral ones.  It's obviously not an issue for larger 
matrices.

Further, I would think a setting like align='center' in pylab.bar() would 
be appropriate.  Any simple way of doing this without manually setting the 
ticks and labels (ironically using forced *.5 ticks)?

I guess I should code and submit it myself. :)

Thanks very much,
Suresh

On Thu, 1 Mar 2007, Eric Firing wrote:

> Suresh Pillai wrote:
>>  I am using imshow to visualise matrices.  When I use align='upper'
>>  (default), the origin is still displayed in the lower left corner on the
>>  axes - i.e. the y-axis is wrong.  The data is plotted correctly with the
>>  origin in the upper left corner.
>>
>>  Seems to be a bug?
>
> No, this is just the way it was designed and has always been.  You can use 
> the "extent" kwarg to control the axes:
>
>       * origin is either upper or lower, which indicates where the [0,0]
>         index of the array is in the upper left or lower left corner of
>         the axes.  If None, default to rc image.origin
>       * extent is a data xmin, xmax, ymin, ymax for making image plots
>         registered with data plots.  Default is the image dimensions
>         in pixels
>
> See the code in axes.spy() for an example of how to get what you want using 
> imshow and the extent kwarg; or use pylab.matshow instead of pylab.imshow. 
> (Probably there should be an axes.matshow convenience method, with 
> pylab.matshow as a wrapper that autogenerates a figure if needed. But at the 
> moment there isn't.)
>
> Eric
>
>>
>>  Cheers,
>>  Suresh
>>
>>  -------------------------------------------------------------------------
>>  Take Surveys. Earn Cash. Influence the Future of IT
>>  Join SourceForge.net's Techsay panel and you'll get the chance to share
>>  your
>>  opinions on IT & business topics through brief surveys-and earn cash
>>  http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>  _______________________________________________
>>  Matplotlib-users mailing list
>>  Matplotlib-users@lists.sourceforge.net
>>  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to