[SciPy-user] Stupid plot question
Thu Nov 20 11:33:02 CST 2008
On Nov 20, 2008, at 12:02 PM, Marco wrote:
> Hi list!
> I have a question about plotting and i haven't found an easy solution
> on the 'net.
> I have a 2d matrix with some values in it: basically they are just
> ones or minus ones, and I want to plot them putting a red "square" (or
> "ball" or "something") on screen (on a grid) if the value of that
> matrix element is one and a blue "something" if it is minus one.
> How can I do that?
How about this -- start ipython w/ the pylab interface and do the
m = array([random.gauss(0,1) for i in range(100)]).reshape((10,10))
m[m<0] = -1
x,y = where(m==-1)
x,y = where(m==1)
In the plot functions, the 'bo' and 'ro' means plot blue/green ('b/o')
open circles ('o')
Hope that helps,
More information about the SciPy-user