Thank you Matthias, Sebastin and Armin!!!
My matrices are square matrices and not rectangular one. I tried the way of
creating a new matrix from existing ones as suggested by matthias and it
worked great. I will try the masked array method too.
Thank you all once again,
Bala
On Wed, May 13, 2009 at 6:45 PM, Matthias Michler
<matthiasmich...@gmx.net>wrote:
> Hi Bala,
>
> I'm not sure I understand, what you want, but maybe the following goes
> towards
> your direction
>
> # initialise two matrices with data
> matrix1 = ones((4,4))
> matrix2 = 2*ones((4,4))
> # and one empty matrix
> matrix3 = zeros((4, 4))
>
> for i in xrange(len(matrix3[:, 0])): # all rows
> for j in xrange(len(matrix3[0, :])):# all columns
> if i > j: # if below diagonal take matrix1
> matrix3[i, j] = matrix1[i, j]
> elif i < j: # if above diagonal take matrix 2
> matrix3[i, j] = matrix2[i, j]
>
> In [40]: print matrix3
> Out[40]:
> array([[ 0., 2., 2., 2.],
> [ 1., 0., 2., 2.],
> [ 1., 1., 0., 2.],
> [ 1., 1., 1., 0.]])
>
> With that matrix3 holds elements of matrix2 in the upper part and elements
> of
> matrix1 below the diagonal. This one could be plotted with contour or
> contourf.
>
> Is that what you want?
>
> best regards Matthias
>
> On Wednesday 13 May 2009 18:12:53 Bala subramanian wrote:
> > Armin,
> > I tried this but what happens is it is not overlapping, actually when i
> > call contour function for the second time with matrix2, the plot is
> updated
> > with contour of matrix 2.
> >
> > contour(matrix1)
> > contour(matrix2).
> >
> > What i finally get is the contour of matrix 2 as the final plot. What i
> am
> > trying to do is that, i shd have one plot, with upper left panel for
> > matrix1 and lower right panel for matrix2 with their separation along the
> > diagonal. I have attached an example picture like which i am trying to
> > make.
> >
> > Bala
> >
> > On Wed, May 13, 2009 at 5:33 PM, Armin Moser
> >
> > <armin.mo...@student.tugraz.at>wrote:
> > > Bala subramanian schrieb:
> > > > hai Armin,
> > > >
> > > > I looked through the examples. I could not find any example of
> > >
> > > overlapping
> > >
> > > > two differnet countours on the same plot.
> > >
> > > I think the first example filled contours does exactly that. You want
> to
> > > show two contours over each other in the same plot.
> > > You just have to substitute the Z in cset_1 with matrix_1 and in cset_2
> > > with matrix_2. Of course it will be helpful to use different colormaps.
> > > E.g. a grey one for the underlying contour and a colored for the top
> one.
> > >
> > > x = arange(5)
> > > y = arange(5)
> > > x,y = meshgrid(x,y)
> > > Z = x**2+y**2
> > > #contourf(Z,cmap=cm.binary) # filled contours gray
> > > contour(Z) # not filled contours colored
> > > error = rand(x.shape[0],x.shape[1]) # to generate a new Z
> > > Z = (x+error)**2+(y+error)**2
> > > contour(Z) # colored not filled contours
> > >
> > > Armin
>
>
>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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