On Tuesday 19 May 2009 14:07:27 Bala subramanian wrote:
> Friends,
>
> Someone please suggest me how to make scatter plot with a matrix data such
> as the one attached. Is is possible to feed a matrix to scatter function
> directly and plot the value in each row of the matrix.
>
> Thanks,
> Bala
Hi Bala,
the following may help ...
from pylab import *
m = loadtxt("test") # load data
# first solution
figure(1)
for i in xrange(len(m[:, 0])):
# run through the columns and plot matrix data
# over index-array
scatter(arange(len(m[i, :])), m[i, :])
# second solution with same result
figure(2)
# generate a x-array, whose elements should correspond to
# the matrix elements (as above)
x = ones(len(m[:, 0]))[:, newaxis]*arange(len(m[0, :]))
scatter(x, m)
show()
for more options of scatter see for instance the docu at
http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=scatter#matplotlib.pyplot.scatter
or the examples at
http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_demo.html?highlight=scatter
http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_demo2.html?highlight=scatter
best regards Matthias
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users