## 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-08-26 02:27:05 ```No problem thanks for helping mdekauwe wrote: > > Perhaps someone else can help as I feel I am being particularly dense. > > for i in xrange(numcols): > ax.plot([np.mean(mass[:,7]) for i in xrange(numcols)], > np.arange(numcols), label=i) > > This gives you what I think you said, but really don't think this is what > you mean as it seems a strange thing to want to do. > > sorry i couldn't be of more help > > > surfcast23 wrote: >> >> Hi, >> >> there is only one column. so I want a plot of y and x. With y taking >> values running from 0 to n or 7 in my example and x as the average of >> the values that are contained in the rows in my example it was 5.57. >> >> >> >> mdekauwe wrote: >>> >>> still don't quite get this, so you want for each column the average? and >>> you want to plot each of these averages? So a bar graph? with 8 bars? >>> >>> >>> >>> surfcast23 wrote: >>>> >>>> Hi, >>>> >>>> I apologize if my explanation was less than clear. What I have is >>>> data in a column that runs from row 1 to row 1268. In each each row >>>> there is a number. For example >>>> >>>> 1 >>>> 3 >>>> 5 >>>> 6 >>>> 7 >>>> 8 >>>> 9 >>>> >>>> so I want the y axis to run from 1 to 7 ( the number of rows) and the >>>> x axis to be the average of the values in this case 5.57. I am having >>>> problems with setting up the y-axis as well as the dimension problem >>>> you addressed. >>>> >>>> Is there a way I could have every value on the x axis the same? Say >>>> for the above example have the x and y axis be >>>> >>>> 7 >>>> 6 >>>> 5 >>>> 4 >>>> 3 >>>> 2 >>>> 1 >>>> 5.75 5.57 5.57 5.75 5.57 5.57 5.75 >>>> >>>> Which would be the number of rows vs the average value of the data in >>>> the rows and then plot that? >>>> >>>> Thanks again >>>> >>>> Khary >>>> >>>> >>>> >>>> mdekauwe wrote: >>>>> >>>>> Hi, >>>>> >>>>> Well the first bit about wanting a specific column and the last bit >>>>> about not wanting to print all the data in and read it back, you get >>>>> that from the example I gave you. If you paste what I wrote for you >>>>> line by line it should become clearer for you, additionally it avoids >>>>> you have to write your own parsing code. >>>>> >>>>> As far as your plotting goes, unless you actually post what you are >>>>> entering in the script (exactly as you have it), then it is impossible >>>>> to say. For example >>>>> >>>>> plt.plot() >>>>> plt.show >>>>> >>>>> there is no way that is all you have? if it is, then of course you >>>>> will get a fail as you are asking matplotlib to plot but are not >>>>> providing it with any data to plot! >>>>> >>>>> Perhaps I am being particularly dense but "What I now need to do is >>>>> have the information in that column plotted as the number of rows vs. >>>>> the mean value of all of the rows." means nothing to me. Sorry. What >>>>> do you want on the X and Y... do you mean you want to plot your >>>>> individual column (8 i think you called it) against the mean of all >>>>> the other rows? If so I would expect you would have a dimensions issue >>>>> >>>>> Martin >>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > -- View this message in context: http://old.nabble.com/How-do-you-Plot-data-generated-by-a-python-script--tp32328822p32338914.html Sent from the matplotlib - users mailing list archive at Nabble.com. ```