>>>>> Pau wrote: >>>>>> ... >>>>>> MODE: 0.00e+00 - 1.00e-04 >>>>>> >>>>>> (2226):********************************************************************************************** >>>>>> 1: 1.00e-04 - 2.00e-04 ( 482):********************* >>>>>> 2: 2.00e-04 - 3.00e-04 ( 273):************ >>>>>> 3: 3.00e-04 - 4.00e-04 ( 173):******** >>>>>> 4: 4.00e-04 - 5.00e-04 ( 125):****** >>>>>> 5: 5.00e-04 - 6.00e-04 ( 99):***** >>>>>> 6: 6.00e-04 - 7.00e-04 ( 68):*** >>>>>> ...
i think it was the last (empty) line which was messing up things. the following works (at least here.....) from scipy import * from matplotlib.pyplot import * from string import split f = open("histo2.dat") data = f.readlines() f.close() x, y, dy = [], [], [] for i, line in enumerate(data): try: y.append(int(line.split('(')[1].split(')')[0])) x.append(i) dy.append(sqrt(y[-1])) except: pass bar(x, y, yerr=dy, align='center') show() main difference is swapping of x and y append(......): if something goes wrong width y, it won't do x and therefore both will have the same length in the end (i think it was complaining about the two not having the same length). as a side note: you might want to use yscale('log') and / or xscale('log') as your data drop pretty fast. good luck & good night, sebastian.
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users