From: Ethan M. <merritt@u.washington.edu> - 2006-01-26 17:27:00
|
On Thursday 26 January 2006 01:36 am, Lars Hecking wrote: > Can anyone help with this? > > ----- Forwarded message from Karine Dionne <k.d...@ja...> > > I am new to Gnuplot and to Linux as well and I am having a bit a > struggle right now. Here is the format of my datafile: > > Day Power1 Power2 Power3 Power4 ... > Day1 y1 y1 y1 y1 ... > Day2 y2 y2 y2 y2 ... > Day3 y3 y3 y3 y3 ... gnuplot 4.1 (Note version number!) #Day along x; Power reading on y # (Note: You must uncomment the first line of your data file # if you want it to be used for generating key titles) # set style data lines set key autotitle columnhead plot 'datafile' using 2:xtic(1), '' using 3, '' using 4, '' using 5 # Power along x; Day on y # This *almost* works, but I'm having trouble getting it # to skip the non-numeric data in the 1st column # I think there's a bug in the program :-( # set style data lines plot 'datafile' matrix using 1:3 every 1:999:1:0, \ '' matrix using 1:3 every 1:999:1:1, \ '' matrix using 1:3 every 1:999:1:2, \ The "matrix using 1:3" causes it to plot rows The "every 1:999:<start column>:<start row>" selects which row and which column to start with. Row and column numbering starts at 0, so putting a 1 for <start column> should skip the first column of data. Unfortunately this is where the bug creeps in; it will skip the first column if the column contains a number, but complains "Bad number in matrix" if the contents are non-numeric. I'll see if I can fix that bug this weekend, but for now you will have to pre-filter the input to remove the first column using some appropriate utility like sed, awk, perl, or egrep. Here I use sed to strip out leading non-blank characters from each line: plot "< sed -e 's/^[^ ]*//' datafile" using 1:3 every 1:999:0:0, \ "" matrix using 1:3 every 1:999:0:1, \ "" matrix using 1:3 every 1:999:0:2, \ etc for all the rows If you want to hit all of the rows together in one command, leave out the "every" clause: plot "< sed -e 's/^[^ ]*//' datafile" using 1:3 So yeah, it's possible. But your specific request seems to have uncovered a bug in the "every" behaviour, so you will need to use some annoying work-around like my sed command above until that's fixed. Ethan > > "DayX" is actually a date string, but that is not my problem > for now. Each column is a power measurement given by a specific > powermeter. There are two types of plots I need to do. > > To begin, I want to compare the performance of each powermeter on a > single plot. So, I would need to generate an X vector for the > powermeters' IDs (from 1 to 32 in steps of 1) and I don't know how to > do that. I would also need to be able to tell gnuplots to proccess > rows, not columns. I browsed the internet and the mailing lists, I > found one thread about it. It was in March 2000 and it says that you > have to reformat your file in another file and then plot the columns. > > There are 2 reasons why I don't want to do that. First of all, this > is a log file that will become very big with time. I am not > interested in having to keep two copies of them. I could keep only > the transposed copy, but this solution is not possible because of the > second type of plot I need. I want to track the changes with time of > the power meters. I will use the date string as the X axis and the > other columns as Y. So, one way or another, I have to access rows of > data for one of my two plots. > > I would like to know if there is a possibility to do that with > gnuplot or if I should consider using something else that could do > the job. I with to find something efficient and as straight forward > as possible. I hope I am not asking for to much. > > Thanks for your time and expertise. > > Karine > > ----- End forwarded message ----- > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files for problems? Stop! Download the new AJAX search engine > that makes searching your log files as easy as surfing the web. > DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121 >642 _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta -- Ethan A Merritt Biomolecular Structure Center University of Washington, Seattle WA |