source: branches/0.6-stable/test/gnuplot_pipe.cc @ 1082

Last change on this file since 1082 was 731, checked in by Peter Johansson, 13 years ago

update copyright statements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1// $Id: gnuplot_pipe.cc 731 2008-12-15 19:03:04Z peter $
2
3/*
4  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
5  Copyright (C) 2007, 2008 Peter Johansson
6
7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
8
9  svndigest is free software; you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13
14  svndigest is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22  02111-1307, USA.
23*/
24
25#include "Gnuplot.h"
26
27#include <vector>
28
29int main(const int argc,const char* argv[])
30{ 
31  using namespace theplu;
32
33  bool ok = false; // false indicates success, i.e., no errors detected.
34
35  std::vector<double> x,y;
36  for (int i=-10; i<=10; ++i) {
37    x.push_back(i);
38    y.push_back(i*i);
39  }
40
41  svndigest::Gnuplot gnuplot1;
42  ok|=gnuplot1.command("set output 'test1.png'; set term png ; set title 'sine'");
43  ok|=gnuplot1.command("plot sin(x) title 'sine of x' with lines");
44
45  svndigest::Gnuplot gnuplot2;
46  ok|=gnuplot2.command("set output 'test2.png'; set term png");
47  ok|=gnuplot2.plot(x);
48
49  svndigest::Gnuplot gnuplot3;
50  ok|=gnuplot3.command("set output 'test3.png'; set term png");
51  gnuplot3.linetitle("parabola");
52  ok|=gnuplot3.plot(x,y);
53  ok|=gnuplot3.command("set output 'test4.png'"); 
54  ok|=gnuplot3.command("set title 'ddddd'");
55  //gnuplot3.linestyle("linespoints");
56  gnuplot3.linetitle("bajs");
57  ok|=gnuplot3.plot(x);
58
59  /*
60  // Jari, if we want to avoid the above usage of plot_x and plot_xy,
61  // we need to do something like this. Of course 'filename.data'
62  // needs to be created by the user (this is hidden for the user in
63  // plot_x and plot_xy). Note, the below example compiles, but will
64  // fail at run time if 'filename.data' does not, miraculously, exist.
65  svndigest::Gnuplot gnuplot4;
66  gnuplot4.command("set output 'test5.png'\nset term png");
67  gnuplot4.command("plot 'filename.data' using 1:2 with linespoints");
68  */
69
70  return ok;
71}
Note: See TracBrowser for help on using the repository browser.