## Re: [Matplotlib-users] How do you Plot data generated by a python script?

 Re: [Matplotlib-users] How do you Plot data generated by a python script? From: surfcast23 - 2011-09-06 17:01:24 ```Thanks for everyone responses and help Che, You are correct on what I have to do. The problem is that I have a data set with ~1250 so I cant' do the sorting or finding the mean by hand. I guess what I need to to is to write a script that will sort the values, bin them, and keep track of the number of values in each bin. Then find the mean value in each bin. Then the scrip has to take the number of values in each bin and plot that versus the mean of each bin. I apologies for the lack of clarity in my earlier posts. It was unclear to me what exactly had to be done until this weekend. Chelonian wrote: > > On Sat, Sep 3, 2011 at 7:32 PM, mdekauwe wrote: >> >> So you do want a histogram then? I assume you have all of this sorted >> then, >> the histogram function is very good. > > I don't think he's describing a histogram, because he is not plotting > frequency of observations on the y axis, but data values (means of > each bin). I think what surfcast23 wants is just a bar graph. > > So, surfcast23, I'd suggest you break it down into your two steps. > First, how will you average your values by bin? You can probably > figure that out by writing it out on paper in pseudo-code and then > just putting it in Python. Then you'll have a list of means, and you > will pass that to the bar function in matplotlib, something like: > > from pylab import * > ax = subplot(111) > x = arange(4) > your_list_of_means = [4,5,7,11] #computed earlier > bar(x, your_list_of_means) > xticks( x + 0.5, ('Bin1', 'Bin2', 'Bin3', 'Bin4') ) > show() > > Che > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/How-do-you-Plot-data-generated-by-a-python-script--tp32328822p32409886.html Sent from the matplotlib - users mailing list archive at Nabble.com. ```