source: trunk/test/gnuplot_pipe_test.cc @ 847

Last change on this file since 847 was 847, checked in by Peter Johansson, 12 years ago

updating copyrights

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