matshow questions

howdy,

I have some beginner type questions with matshow.

I want the origin of the axes to be the lower left of the figure. I tried:
  fig=matshow(data, cmap, origin='lower')

but that didn't seem to do anything. Actually, I want to flip the figure over upper left->lower right diagonal and I want to
do this without explicitly transposing the matrix if possible.

I also am having trouble with the figure size. I am working on a weird dpi (93.65) screen. I tried
  fig.set_figsize_inches((5.,5.))
  fig.set_dpi(93.6585)

But the screen dimensions still come out off. They are in fact 5 5/16" x 5 5/16". Any ideas?

thanks,
danny

Here's a full file:

···

#####################################
from pylab import *
from matplotlib import cm

data=zeros((10,10))
for i in range(10):
  for j in range(10):
    data[i,j]=i+j
    
fig=matshow(data, cm.jet)#, origin='lower'
fig.set_figsize_inches((5.,5.))
fig.set_dpi(72.) #93.6585

savefig('tempPic.png')

Hi Danny,

Danny Shevitz wrote:

howdy,

I have some beginner type questions with matshow.

I want the origin of the axes to be the lower left of the figure. I tried:
  fig=matshow(data, cmap, origin='lower')

but that didn't seem to do anything. Actually, I want to flip the figure over upper left->lower right diagonal and I want to
do this without explicitly transposing the matrix if possible.

I also am having trouble with the figure size. I am working on a weird dpi (93.65) screen. I tried
  fig.set_figsize_inches((5.,5.))
  fig.set_dpi(93.6585)

But the screen dimensions still come out off. They are in fact 5 5/16" x 5 5/16". Any ideas?

Even though I wrote matshow, I have to admit that it was very much a 'stumble in the dark' kind of code. I basically just mucked around with imshow enough to get a matrix to display in the 'traditional' way (top-down, with properly preserved aspect ratio) and that was about it. I'm sure the code can use improvements, but at the time I can't commit any effort into it, I'm afraid.

If you can extend it (the code is extremely simple) in a useful way, just send a patch over and I'm sure we can apply it.

Regards,

f