Another, slightly more flexible, option is the genfromtxt function, also in numpy. Normally you should try genfromtxt after loadtxt doesn't work. Or, that is my normal method.
Steven On Wed Mar 27 07:16:45 2013, Sayan Chatterjee wrote: > Thank you very much for your prompt reply. > > Florian, your reply seems to be the answer to my question. I'll try > it out. If can't figure out,I'll get back to you. > > > On 27 March 2013 15:37, Florian M. Wagner <wagne...@student.ethz.ch > <mailto:wagne...@student.ethz.ch>> wrote: > > Hey Sayan, > > for reading in simple ASCII-Files containing your two arrays you > should have a look at the numpy.loadtxt function. > > Scatter plots in matplotlib are then easily created as shown here > http://matplotlib.org/examples/pylab_examples/scatter_demo.html > > For your purpose you can do something like: > > import os > import numpy as np > import matplotlib.pyplot as plt > > for file in os.path.listdir(): > x, y = np.loadtxt(file, unpack=True) > plt.scatter(x,y) > plt.savefig(file + '.png') > > Cheers, > > Florian > > > Am 27.03.2013 09:32, schrieb Sayan Chatterjee: >> Dear All, >> >> I'm new to Matplotlib. It might be a silly question, how does one >> plot data(not functions) in Matplotlib. >> >> How: >> 1)Two arrays (X and Y) can be plotted in a scatter diagram? >> >> 2) or a number of data files can used to produce different plots >> having different(sequential) name? >> >> Thanks in anticipation. >> Regards, >> Sayan >> >> -- >> >> >> >> -------------------------------------------------------------------------- >> *Sayan Chatterjee* >> Dept. of Physics and Meteorology >> IIT Kharagpur >> Lal Bahadur Shastry Hall of Residence >> Room AB 205 >> Mob: +91 9874513565 >> blog: www.blissprofound.blogspot.com >> <http://www.blissprofound.blogspot.com> >> >> Volunteer , Padakshep >> www.padakshep.org <http://www.padakshep.org> >> >> >> >> ------------------------------------------------------------------------------ >> Own the Future-Intel® Level Up Game Demo Contest 2013 >> Rise to greatness in Intel's independent game demo contest. >> Compete for recognition, cash, and the chance to get your game >> on Steam. $5K grand prize plus 10 genre and skill prizes. >> Submit your demo by 6/6/13.http://p.sf.net/sfu/intel_levelupd2d >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> <mailto:Matplotlib-users@lists.sourceforge.net> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > ------------------------------------------------------------------------------ > Own the Future-Intel® Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. > Compete for recognition, cash, and the chance to get your game > on Steam. $5K grand prize plus 10 genre and skill prizes. > Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > <mailto:Matplotlib-users@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > -- > > > -------------------------------------------------------------------------- > *Sayan Chatterjee* > Dept. of Physics and Meteorology > IIT Kharagpur > Lal Bahadur Shastry Hall of Residence > Room AB 205 > Mob: +91 9874513565 > blog: www.blissprofound.blogspot.com > <http://www.blissprofound.blogspot.com> > > Volunteer , Padakshep > www.padakshep.org <http://www.padakshep.org> > > > ------------------------------------------------------------------------------ > Own the Future-Intel® Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. > Compete for recognition, cash, and the chance to get your game > on Steam. $5K grand prize plus 10 genre and skill prizes. > Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas A&M University bo...@physics.tamu.edu ------------------------------------------------------------------------------ Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users