source: trunk/test/gnuplot_pipe.cc @ 270

Last change on this file since 270 was 149, checked in by Jari Häkkinen, 15 years ago

Changed svnstat to svndigest.

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