Hey Sayan, Here is the manual page:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html It works (basically) the same as loadtxt, but it is more flexible when there are holes in your data. Good luck. Steven On Wed Mar 27 10:07:10 2013, Sayan Chatterjee wrote: > Hi Steven, > > I am a newbie to Python and hence Matplotlib. I cannot get your point > properly. Could you please redirect me to a page where the usage is > demonstrated? > > As I can see, you're a doctoral student in Physics, it might be > worthwhile to tell you that I'm trying to code a Zeldovich > Approximation for a simple sinusoidal potential and want to make it > evolve with varying scale factor and make an animation of it. > > Cheers, > Sayan > > > On 27 March 2013 19:58, Steven Boada <bo...@physics.tamu.edu > <mailto:bo...@physics.tamu.edu>> wrote: > > 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> > <mailto: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 > <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> > <http://www.blissprofound.__blogspot.com > <http://www.blissprofound.blogspot.com>> > > Volunteer , Padakshep > www.padakshep.org <http://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 > <http://p.sf.net/sfu/intel_levelupd2d> > > > _________________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.__sourceforge.net > <mailto:Matplotlib-users@lists.sourceforge.net> > <mailto:Matplotlib-users@__lists.sourceforge.net > <mailto:Matplotlib-users@lists.sourceforge.net>> > https://lists.sourceforge.net/__lists/listinfo/matplotlib-__users > <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 > <http://p.sf.net/sfu/intel_levelupd2d> > _________________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.__sourceforge.net > <mailto:Matplotlib-users@lists.sourceforge.net> > <mailto:Matplotlib-users@__lists.sourceforge.net > <mailto:Matplotlib-users@lists.sourceforge.net>> > https://lists.sourceforge.net/__lists/listinfo/matplotlib-__users > <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> > <http://www.blissprofound.__blogspot.com > <http://www.blissprofound.blogspot.com>> > > Volunteer , Padakshep > www.padakshep.org <http://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 > <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 > <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 <mailto:bo...@physics.tamu.edu> > > > > > -- > > > -------------------------------------------------------------------------- > *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> -- 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