Sebastian Busch wrote:
> Matthias Michler wrote:
>> ...
>> for i in xrange(len(matrix3[:, 0])): # all rows
>>     for j in xrange(len(matrix3[0, :])):# all columns
>> ...
> 
> if your matrices a and b are rectangular (and i think the "diagonal"
> makes only sense in this case), you can also say:
> 
> array([list(a[i,:i])+list(b[i,i:]) for i in range(a.shape[0])])
It seems that I did not understand what you tried to reach. Sorry for
pointing into the wrong direction.

Another possibility would be to use masked arrays:

------------------------8<-------------------------------------
from pylab import *

x = arange(100)
y = arange(100)
x,y = meshgrid(x,y)
Z = x**2+y**2
mask = ones(Z.shape)
# contour, imshow, pcolor do not show values at positions
# where the mask is True
lower_left_masked = triu(mask)==0 # lower left part in matrix masked
Z = ma.masked_array(Z,mask=lower_left_masked)
contourf(Z,origin='lower')

error = rand(x.shape[0],x.shape[1])
upper_right_masked = tril(mask)==0
Z = (x+error)**2+(y+error)**2
Z = ma.masked_array(Z,mask=upper_right_masked)
contourf(Z,cmap=cm.binary)
axis('tight')
show()

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to