|
From: Torquil M. S. <to...@gm...> - 2009-01-24 14:09:02
|
Hello, can gnuplot draw a piecewise constant graph from a simple data file? Here is an example: Let the data file be like the following: 0 0 1 1 2 2 Then I want a graph that is 0 on x \in [0,1), 1 on [1,2), and so on. Is that possible in gnuplot without modifying the data file? I guess it is possible to run a complicated series of command to filter the data file as gnuplot reads it, but I'm would like to be able to do something along the lines of: plot "data.txt" using 1:2 blabla where "blabla" is some setting that specifies that gnuplot should use a piecewise constant "interpolation" between data points. In fact, one should also be able to specify if any vertical lines should be visible or not. Right now I generate a modified data file to accomplish this (containing additional data points): 0 0 0.99 0 1 1 1.99 1 2 2 Best regards Torquil Sørensen Norway |
|
From: Thomas S. <t.s...@fz...> - 2009-01-24 16:39:02
|
plot "data.txt" using 1:2 with steps Torquil Macdonald Sørensen wrote: > > Hello, can gnuplot draw a piecewise constant graph from a simple data > file? > > Here is an example: Let the data file be like the following: > > 0 0 > 1 1 > 2 2 > > Then I want a graph that is 0 on x \in [0,1), 1 on [1,2), and so on. Is > that possible in gnuplot without modifying the data file? > > I guess it is possible to run a complicated series of command to filter > the data file as gnuplot reads it, but I'm would like to be able to do > something along the lines of: > > plot "data.txt" using 1:2 blabla > > where "blabla" is some setting that specifies that gnuplot should use a > piecewise constant "interpolation" between data points. In fact, one > should also be able to specify if any vertical lines should be visible > or not. > > Right now I generate a modified data file to accomplish this (containing > additional data points): > > 0 0 > 0.99 0 > 1 1 > 1.99 1 > 2 2 > > Best regards > Torquil Sørensen > Norway > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Gnuplot-info mailing list > Gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://www.nabble.com/Piecewise-constant-plot-tp21640994p21641757.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Torquil M. S. <to...@gm...> - 2009-01-24 16:48:52
|
Thanks Thomas, it works like a charm. Now I can simplify my data file output. Best regards Torquil Sørensen Norway Thomas Sefzick wrote: > plot "data.txt" using 1:2 with steps > > > Torquil Macdonald Sørensen wrote: >> Hello, can gnuplot draw a piecewise constant graph from a simple data >> file? >> >> Here is an example: Let the data file be like the following: >> >> 0 0 >> 1 1 >> 2 2 >> >> Then I want a graph that is 0 on x \in [0,1), 1 on [1,2), and so on. Is >> that possible in gnuplot without modifying the data file? >> >> I guess it is possible to run a complicated series of command to filter >> the data file as gnuplot reads it, but I'm would like to be able to do >> something along the lines of: >> >> plot "data.txt" using 1:2 blabla >> >> where "blabla" is some setting that specifies that gnuplot should use a >> piecewise constant "interpolation" between data points. In fact, one >> should also be able to specify if any vertical lines should be visible >> or not. >> >> Right now I generate a modified data file to accomplish this (containing >> additional data points): >> >> 0 0 >> 0.99 0 >> 1 1 >> 1.99 1 >> 2 2 >> >> Best regards >> Torquil Sørensen >> Norway >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword >> _______________________________________________ >> Gnuplot-info mailing list >> Gnu...@li... >> https://lists.sourceforge.net/lists/listinfo/gnuplot-info >> >> > |