Last change
on this file since 69 was
36,
checked in by Jari Häkkinen, 17 years ago
|
Changed Gnuplot interface. Fixed sever bug in Stats::accumulated(void).
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Id
|
File size:
1.3 KB
|
Rev | Line | |
---|
[26] | 1 | // $Id: gnuplot_pipe.cc 36 2006-01-13 01:05:53Z jari $ |
---|
| 2 | |
---|
[31] | 3 | #include "Gnuplot.h" |
---|
[26] | 4 | |
---|
[31] | 5 | #include <vector> |
---|
[26] | 6 | |
---|
| 7 | int main(const int argc,const char* argv[]) |
---|
| 8 | { |
---|
[27] | 9 | using namespace theplu; |
---|
[26] | 10 | |
---|
| 11 | bool ok = true; |
---|
| 12 | |
---|
| 13 | std::vector<double> x,y; |
---|
| 14 | for (int i=-10; i<=10; ++i) { |
---|
| 15 | x.push_back(i); |
---|
| 16 | y.push_back(i*i); |
---|
| 17 | } |
---|
| 18 | |
---|
[31] | 19 | svnstat::Gnuplot gnuplot1; |
---|
| 20 | gnuplot1.command("set output 'test1.png'; set term png ; set title 'sine'"); |
---|
| 21 | gnuplot1.command("plot sin(x) title 'sine of x' with lines"); |
---|
[26] | 22 | |
---|
[31] | 23 | svnstat::Gnuplot gnuplot2; |
---|
| 24 | gnuplot2.command("set output 'test2.png'; set term png"); |
---|
[36] | 25 | gnuplot2.plot(x); |
---|
[26] | 26 | |
---|
[31] | 27 | svnstat::Gnuplot gnuplot3; |
---|
| 28 | gnuplot3.command("set output 'test3.png'; set term png"); |
---|
| 29 | gnuplot3.linetitle("parabola"); |
---|
[36] | 30 | gnuplot3.plot(x,y); |
---|
[26] | 31 | |
---|
[31] | 32 | gnuplot3.command("set output 'test4.png'; set title 'composite'"); |
---|
| 33 | gnuplot3.linestyle("linespoints"); |
---|
| 34 | gnuplot3.linetitle(""); |
---|
[36] | 35 | gnuplot3.replot(x); |
---|
[26] | 36 | |
---|
[32] | 37 | /* |
---|
[26] | 38 | // Jari, if we want to avoid the above usage of plot_x and plot_xy, |
---|
| 39 | // we need to do something like this. Of course 'filename.data' |
---|
| 40 | // needs to be created by the user (this is hidden for the user in |
---|
| 41 | // plot_x and plot_xy). Note, the below example compiles, but will |
---|
| 42 | // fail at run time if 'filename.data' does not, miraculously, exist. |
---|
[31] | 43 | svnstat::Gnuplot gnuplot4; |
---|
| 44 | gnuplot4.command("set output 'test5.png'\nset term png"); |
---|
| 45 | gnuplot4.command("plot 'filename.data' using 1:2 with linespoints"); |
---|
[32] | 46 | */ |
---|
[26] | 47 | |
---|
| 48 | return (ok ? 0 : -1); |
---|
| 49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.