Try to have none-overlapping labels in one axe using matshow

Hello,

This question has certainly been answered in a previous thread but after
searching around I did not find any solution...

I have got a matrix 6x500 (so one size is much biggger than the other one)
and I try to expand the shorter axe so that the labels on it are well
displayed (not overlapped.

I am googling/searching on the documentation about subplots_adjust, ... but
did not find any solution.

Here is the code that present the problem I have.

Thanks in advance for any help. Olivier

import numpy as np
from matplotlib.pylab import *
import matplotlib.pyplot as plt

sizeX = 6
sizeY = 500

xlabels = []
ylabels = []

for i in range ( 0, sizeX ):
  xlabels.append( str( i ) )

for i in range ( 0, sizeY ):
  ylabels.append( str( i ) )

dims = ( sizeX, sizeY )

data = zeros( dims )
for i in range( 0, sizeX ):
  for j in range( 0, sizeY ):
    data[ i, j ] = np.random.rand()

figure = plt.figure()
axes = figure.add_subplot( 111 )
cax = axes.matshow( data, interpolation = 'nearest' )
col = figure.colorbar( cax )

plt.show()

···

--
View this message in context: http://old.nabble.com/Try-to-have-none-overlapping-labels-in-one-axe-using-matshow-tp31456159p31456159.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

2011/4/23 _olivier_ <oliriff@...287...>:

[...]

I have got a matrix 6x500 (so one size is much biggger than the other one)
and I try to expand the shorter axe so that the labels on it are well
displayed (not overlapped.

Use the aspect kwarg in matshow.

Goyo

Indeed setting aspect = 'auto' in matshow solved my problem.

Thanks a lot !

Goyo wrote:

···

2011/4/23 _olivier_ <oliriff@...287...>:

[...]

I have got a matrix 6x500 (so one size is much biggger than the other
one)
and I try to expand the shorter axe so that the labels on it are well
displayed (not overlapped.

Use the aspect kwarg in matshow.

Goyo

------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been
demonstrated beyond question. Learn why your peers are replacing JEE
containers with lightweight application servers - and what you can gain
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
View this message in context: http://old.nabble.com/Try-to-have-none-overlapping-labels-in-one-axe-using-matshow-tp31456159p31478955.html
Sent from the matplotlib - users mailing list archive at Nabble.com.