Ciarán Mooney wrote: > Hi, > > I have an ASCII data set, which includes null data points. eg > > 1 x1 y1 z1 > 2 x2 y2 z2 > 3 x3 y3 z3 > 4 y3 z3 > 5 y4 z4 > 6 y5 > > I am using ipython with pylab enabled, and the load("/xxx/xxx") > function. However it chokes on the blank, "null", values. How can I > get this data set into matplotlib?
I assume the file is using fixed-length fields. I don't know of any ready-made tool for reading files with non-delimited fields, with or without gaps, so you probably have to write your own to fit your particular file. The general approach would be to read a line in as a character string, use slices to isolate the fields, try to convert each to a number, and if it fails put in a flag value. These numbers can go in a list, and as you go through the lines you accumulate the lists in a list. Then you can use numpy.ma.masked_equal(your_list_of_lists, your_flag_value) to create a 2-D masked array suitable for use by mpl. Eric > > Regards, > > Ciarán > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users