00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <string>
00004 #include <vector>
00005 #include <stdint.h>
00006
00007 #ifndef GNUPLOT_H
00008 #define GNUPLOT_H
00009
00010 using std::string;
00011 class GnuPlot {
00012 static int m_count;
00013
00014 private:
00015 string m_font;
00016 protected:
00017
00018 int m_bPlot;
00019 int m_bLeave;
00020 int m_bPlot3D;
00021 std::string m_arg;
00022 string m_dir;
00023 double m_MinX,m_MaxX,m_MaxY,m_MinY;
00024 FILE *m_file;
00025 std::vector<std::string> m_List;
00026 public:
00027
00028 GnuPlot();
00029 ~GnuPlot();
00030
00031 string getDataFileName();
00032 std::string newDataFile(std::ofstream &fout);
00033 void plot(std::string expr,std::string name="",std::string comp="");
00034 void splot(std::string expr,std::string name="",std::string comp="");
00035 void setIntervalX(double minX,double maxX);
00036 void setInterval(double minX, double maxX,double minY=0,double maxY=0);
00037 void Draw();
00038 void runSystemCommand(const char*);
00039 std::string plotPoints(double X[],int lines,int cols,std::string name="",std::string comp="",std::string with="",int bRowOrder=0,int bTrans=0,int blockSize =2147483640);
00040 std::string plotPoints3d(double X[],int lines,int cols,std::string name="",std::string comp="",std::string with="",int bRowOrder=0,int bTrans=0,int blockSize =2147483640);
00041
00042
00043 void plotPoints(std::string strFileName,std::string name="",std::string comp="");
00044 void plotPoints(std::string strFileName,std::string name,int index1,int index2,int col1,int col2,std::string comp="");
00045 void plotPoints3d(std::string strFileName,std::string name="",std::string comp="");
00046 void pause(double dSec,std::string str_comment="");
00047 void NextScene();
00048 void NextPlot();
00049 void xRange(double a,double b);
00050 void yRange(double a,double b);
00051 void zRange(double a,double b);
00052 void define(std::string var,std::string expr);
00053 void define(std::string var,double num);
00054 void set(std::string var,std::string value);
00055 void set(std::string var,int value);
00056 void unset(std::string var);
00057 void setOutput(std::string strOutput);
00058 void setTitle(std::string strTitle);
00059 void setArg(std::string strArg);
00060 void setFont(string font);
00061 void setOutputEpsMono(std::string strOutput);
00062 void finalize();
00063 void leaveFiles(int bLeave);
00064
00065 };
00066
00067 #endif