Last change
on this file since 80 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
|
Line | |
---|
1 | // $Id: gnuplot_pipe.cc 36 2006-01-13 01:05:53Z jari $ |
---|
2 | |
---|
3 | #include "Gnuplot.h" |
---|
4 | |
---|
5 | #include <vector> |
---|
6 | |
---|
7 | int main(const int argc,const char* argv[]) |
---|
8 | { |
---|
9 | using namespace theplu; |
---|
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 | |
---|
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"); |
---|
22 | |
---|
23 | svnstat::Gnuplot gnuplot2; |
---|
24 | gnuplot2.command("set output 'test2.png'; set term png"); |
---|
25 | gnuplot2.plot(x); |
---|
26 | |
---|
27 | svnstat::Gnuplot gnuplot3; |
---|
28 | gnuplot3.command("set output 'test3.png'; set term png"); |
---|
29 | gnuplot3.linetitle("parabola"); |
---|
30 | gnuplot3.plot(x,y); |
---|
31 | |
---|
32 | gnuplot3.command("set output 'test4.png'; set title 'composite'"); |
---|
33 | gnuplot3.linestyle("linespoints"); |
---|
34 | gnuplot3.linetitle(""); |
---|
35 | gnuplot3.replot(x); |
---|
36 | |
---|
37 | /* |
---|
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. |
---|
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"); |
---|
46 | */ |
---|
47 | |
---|
48 | return (ok ? 0 : -1); |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.