|
From: Jian-Ming Z. <jm...@gm...> - 2013-08-22 07:54:32
|
Hi, I have a data file which contains several columns. The data in the file are not sorted. I want to sort the data of a column (for example, column 3) and plot the data. I use UNIX command sort to sort the data and then use gnuplot to plot the data. $ sort -k3nr datafile > sortfile # sort column 3 in decreasing order gnuplot> plot 'sortfile' u 3 w linespoints # plot sorted values of column 3 at x = 0, 1, 2, … Is it possible to directly sort the data and plot the results in gnuplot? If yes, how to do it? Thanks |
|
From: Hans-Bernhard B. <HBB...@t-...> - 2013-08-22 20:34:18
|
On 22.08.2013 09:54, Jian-Ming Zheng wrote: > Hi, > > I have a data file which contains several columns. The data in the > file are not sorted. I want to sort the data of a column (for example, > column 3) and plot the data. I use UNIX command sort to sort the data > and then use gnuplot to plot the data. > > $ sort -k3nr datafile > sortfile # sort column 3 in decreasing order > gnuplot> plot 'sortfile' u 3 w linespoints # plot sorted values of > column 3 at x = 0, 1, 2, … > > Is it possible to directly sort the data and plot the results in > gnuplot? If yes, how to do it? See "help smooth", then "help smooth unique". |
|
From: Jian-Ming Z. <jm...@gm...> - 2013-08-23 02:22:23
|
Hi, Thanks for the reply. I have tried "smooth unique," but it did not work for me. For example, the data file is shown as follow. 1 10 2 15 3 1 4 15 5 30 I want plot column 2 as y values in order of the values. That is, the first y value is 30, the second y value is 15, the third value is 15, and so on. I can do so by sorting the file by column 2. The file is sorted as follows. 5 30 2 15 4 15 1 10 3 1 Then I plot the sorted file by using: plot 'datafile' using 2 w linespoints Please kindly let me know how to use "smooth unique" to do so. Thanks. On Fri, Aug 23, 2013 at 4:33 AM, Hans-Bernhard Bröker <HBB...@t-...> wrote: > On 22.08.2013 09:54, Jian-Ming Zheng wrote: >> >> Hi, >> >> I have a data file which contains several columns. The data in the >> file are not sorted. I want to sort the data of a column (for example, >> column 3) and plot the data. I use UNIX command sort to sort the data >> and then use gnuplot to plot the data. >> >> $ sort -k3nr datafile > sortfile # sort column 3 in decreasing order >> gnuplot> plot 'sortfile' u 3 w linespoints # plot sorted values of >> column 3 at x = 0, 1, 2, … >> >> Is it possible to directly sort the data and plot the results in >> gnuplot? If yes, how to do it? > > > See "help smooth", then "help smooth unique". > > |
|
From: Clement L. <the...@gm...> - 2013-08-23 07:36:32
|
Hello, I did this yesterday, in fact. In gnuplot, issue: plot "< sort -kn3nr datafile" u 1:3 w lp This should be roughly what you want. Clem On 22 August 2013 08:54, Jian-Ming Zheng <jm...@gm...> wrote: > Hi, > > I have a data file which contains several columns. The data in the > file are not sorted. I want to sort the data of a column (for example, > column 3) and plot the data. I use UNIX command sort to sort the data > and then use gnuplot to plot the data. > > $ sort -k3nr datafile > sortfile # sort column 3 in decreasing order > gnuplot> plot 'sortfile' u 3 w linespoints # plot sorted values of > column 3 at x = 0, 1, 2, … > > Is it possible to directly sort the data and plot the results in > gnuplot? If yes, how to do it? > > Thanks > > > ------------------------------------------------------------------------------ > Introducing Performance Central, a new site from SourceForge and > AppDynamics. Performance Central is your source for news, insights, > analysis and resources for efficient Application Performance Management. > Visit us today! > http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > |
|
From: Jian-Ming Z. <jm...@gm...> - 2013-08-23 08:06:41
|
Hi, Clem, Thanks a lot for the help. It works. On Fri, Aug 23, 2013 at 3:36 PM, Clement Law <the...@gm...> wrote: > Hello, > > I did this yesterday, in fact. > > In gnuplot, issue: > > plot "< sort -kn3nr datafile" u 1:3 w lp > > This should be roughly what you want. > > Clem > > > On 22 August 2013 08:54, Jian-Ming Zheng <jm...@gm...> wrote: >> >> Hi, >> >> I have a data file which contains several columns. The data in the >> file are not sorted. I want to sort the data of a column (for example, >> column 3) and plot the data. I use UNIX command sort to sort the data >> and then use gnuplot to plot the data. >> >> $ sort -k3nr datafile > sortfile # sort column 3 in decreasing order >> gnuplot> plot 'sortfile' u 3 w linespoints # plot sorted values of >> column 3 at x = 0, 1, 2, … >> >> Is it possible to directly sort the data and plot the results in >> gnuplot? If yes, how to do it? >> >> Thanks >> >> >> ------------------------------------------------------------------------------ >> Introducing Performance Central, a new site from SourceForge and >> AppDynamics. Performance Central is your source for news, insights, >> analysis and resources for efficient Application Performance Management. >> Visit us today! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk >> _______________________________________________ >> gnuplot-info mailing list >> gnu...@li... >> https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > |