30 #ifndef _GNUPLOT_PIPES_H_ 31 #define _GNUPLOT_PIPES_H_ 45 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 48 #define GP_MAX_TMP_FILES 27 // 27 temporary files it's Microsoft restriction 49 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 52 #define GP_MAX_TMP_FILES 64 54 #error unsupported or unknown operating system 94 std::vector<std::string> tmpfile_list;
99 static int tmpfile_num;
101 static std::string m_sGNUPlotFileName;
103 static std::string m_sGNUPlotPath;
105 static std::string terminal_std;
120 std::string create_tmpfile(std::ofstream &tmp);
127 static bool get_program_path();
137 bool file_available(
const std::string &filename);
147 static bool file_exists(
const std::string &filename,
int mode=0);
159 static bool set_GNUPlotPath(
const std::string &path);
170 static void set_terminal_std(
const std::string &type);
178 explicit Gnuplot(
const std::string &style =
"points");
181 Gnuplot(
const std::vector<double> &x,
182 const std::string &title =
"",
183 const std::string &style =
"points",
184 const std::string &labelx =
"x",
185 const std::string &labely =
"y");
188 Gnuplot(
const std::vector<double> &x,
189 const std::vector<double> &y,
190 const std::string &title =
"",
191 const std::string &style =
"points",
192 const std::string &labelx =
"x",
193 const std::string &labely =
"y");
196 Gnuplot(
const std::vector<double> &x,
197 const std::vector<double> &y,
198 const std::vector<double> &z,
199 const std::string &title =
"",
200 const std::string &style =
"points",
201 const std::string &labelx =
"x",
202 const std::string &labely =
"y",
203 const std::string &labelz =
"z");
212 Gnuplot& cmd(
const std::string &cmdstr);
235 Gnuplot& savetops(
const std::string &filename =
"gnuplot_output");
244 Gnuplot& set_style(
const std::string &stylestr =
"points");
250 Gnuplot& set_smooth(
const std::string &stylestr =
"csplines");
262 Gnuplot& set_pointsize(
const double pointsize = 1.0);
286 Gnuplot& set_samples(
const int samples = 100);
288 Gnuplot& set_isosamples(
const int isolines = 10);
305 Gnuplot& set_contour(
const std::string &position =
"base");
331 Gnuplot& set_legend(
const std::string &position =
"default");
351 cmdstr =
"set title \"";
368 Gnuplot& set_ylabel(
const std::string &label =
"x");
370 Gnuplot& set_xlabel(
const std::string &label =
"y");
372 Gnuplot& set_zlabel(
const std::string &label =
"z");
375 Gnuplot& set_xrange(
const double iFrom,
378 Gnuplot& set_yrange(
const double iFrom,
381 Gnuplot& set_zrange(
const double iFrom,
405 Gnuplot& set_xlogscale(
const double base = 10);
407 Gnuplot& set_ylogscale(
const double base = 10);
409 Gnuplot& set_zlogscale(
const double base = 10);
434 Gnuplot& set_cbrange(
const double iFrom,
const double iTo);
442 Gnuplot& plotfile_x(
const std::string &filename,
443 const unsigned int column = 1,
444 const std::string &title =
"");
447 Gnuplot& plot_x(
const X& x,
const std::string &title =
"");
452 Gnuplot& plotfile_xy(
const std::string &filename,
453 const unsigned int column_x = 1,
454 const unsigned int column_y = 2,
455 const std::string &title =
"");
457 template<
typename X,
typename Y>
458 Gnuplot& plot_xy(
const X& x,
const Y& y,
const std::string &title =
"");
463 Gnuplot& plotfile_xy_err(
const std::string &filename,
464 const unsigned int column_x = 1,
465 const unsigned int column_y = 2,
466 const unsigned int column_dy = 3,
467 const std::string &title =
"");
469 template<
typename X,
typename Y,
typename E>
470 Gnuplot& plot_xy_err(
const X &x,
const Y &y,
const E &dy,
471 const std::string &title =
"");
476 Gnuplot& plotfile_xyz(
const std::string &filename,
477 const unsigned int column_x = 1,
478 const unsigned int column_y = 2,
479 const unsigned int column_z = 3,
480 const std::string &title =
"");
482 template<
typename X,
typename Y,
typename Z>
486 const std::string &title =
"");
491 Gnuplot& plot_slope(
const double a,
493 const std::string &title =
"");
506 Gnuplot& plot_equation(
const std::string &equation,
507 const std::string &title =
"");
511 Gnuplot& plot_equation3d(
const std::string &equation,
512 const std::string &title =
"");
516 Gnuplot& plot_image(
const unsigned char *ucPicBuf,
517 const unsigned int iWidth,
518 const unsigned int iHeight,
519 const std::string &title =
"");
536 void remove_tmpfiles();
551 int Gnuplot::tmpfile_num = 0;
553 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 554 std::string Gnuplot::m_sGNUPlotFileName =
"gnuplot.exe";
555 std::string Gnuplot::m_sGNUPlotPath =
"C:/program files/gnuplot/bin/";
556 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 557 std::string Gnuplot::m_sGNUPlotFileName =
"gnuplot";
558 std::string Gnuplot::m_sGNUPlotPath =
"/usr/local/bin/";
561 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 562 std::string Gnuplot::terminal_std =
"windows";
563 #elif ( defined(unix) || defined(__unix) || defined(__unix__) ) && !defined(__APPLE__) 564 std::string Gnuplot::terminal_std =
"x11";
565 #elif defined(__APPLE__) 566 std::string Gnuplot::terminal_std =
"aqua";
574 :gnucmd(NULL) ,valid(false) ,two_dim(false) ,nplots(0)
586 const std::string &title,
587 const std::string &style,
588 const std::string &labelx,
589 const std::string &labely)
590 :gnucmd(NULL) ,valid(false) ,two_dim(false) ,nplots(0)
607 const std::vector<double> &y,
608 const std::string &title,
609 const std::string &style,
610 const std::string &labelx,
611 const std::string &labely)
612 :gnucmd(NULL) ,valid(false) ,two_dim(false) ,nplots(0)
629 const std::vector<double> &y,
630 const std::vector<double> &z,
631 const std::string &title,
632 const std::string &style,
633 const std::string &labelx,
634 const std::string &labely,
635 const std::string &labelz)
636 :gnucmd(NULL) ,valid(false) ,two_dim(false) ,nplots(0)
663 std::string name = create_tmpfile(tmp);
670 for (
unsigned int i = 0; i < x.size(); i++)
671 tmp << x[i] << std::endl;
687 template<
typename X,
typename Y>
690 if (x.size() == 0 || y.size() == 0)
696 if (x.size() != y.size())
704 std::string name = create_tmpfile(tmp);
711 for (
unsigned int i = 0; i < x.size(); i++)
712 tmp << x[i] <<
" " << y[i] << std::endl;
727 template<
typename X,
typename Y,
typename E>
731 const std::string &title)
733 if (x.size() == 0 || y.size() == 0 || dy.size() == 0)
739 if (x.size() != y.size() || y.size() != dy.size())
747 std::string name = create_tmpfile(tmp);
754 for (
unsigned int i = 0; i < x.size(); i++)
755 tmp << x[i] <<
" " << y[i] <<
" " << dy[i] << std::endl;
772 template<
typename X,
typename Y,
typename Z>
776 const std::string &title)
778 if (x.size() == 0 || y.size() == 0 || z.size() == 0)
784 if (x.size() != y.size() || x.size() != z.size())
792 std::string name = create_tmpfile(tmp);
799 for (
unsigned int i = 0; i < x.size(); i++)
800 tmp << x[i] <<
" " << y[i] <<
" " << z[i] <<std::endl;
820 std::string tmp = path +
"/" + Gnuplot::m_sGNUPlotFileName;
823 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 824 if ( Gnuplot::file_exists(tmp,0) )
825 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 826 if ( Gnuplot::file_exists(tmp,1) )
829 Gnuplot::m_sGNUPlotPath = path;
834 Gnuplot::m_sGNUPlotPath.clear();
847 #if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 848 if (type.find(
"x11") != std::string::npos && getenv(
"DISPLAY") == NULL)
855 Gnuplot::terminal_std = type;
865 template <
typename Container>
866 void stringtok (Container &container,
867 std::string
const &in,
868 const char *
const delimiters =
" \t\n")
870 const std::string::size_type len = in.length();
871 std::string::size_type i = 0;
876 i = in.find_first_not_of (delimiters, i);
878 if (i == std::string::npos)
882 std::string::size_type j = in.find_first_of (delimiters, i);
885 if (j == std::string::npos)
887 container.push_back (in.substr(i));
891 container.push_back (in.substr(i, j-i));
910 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 911 if (_pclose(gnucmd) == -1)
912 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 913 if (pclose(gnucmd) == -1)
958 if (stylestr.find(
"lines") == std::string::npos &&
959 stylestr.find(
"points") == std::string::npos &&
960 stylestr.find(
"linespoints") == std::string::npos &&
961 stylestr.find(
"impulses") == std::string::npos &&
962 stylestr.find(
"dots") == std::string::npos &&
963 stylestr.find(
"steps") == std::string::npos &&
964 stylestr.find(
"fsteps") == std::string::npos &&
965 stylestr.find(
"histeps") == std::string::npos &&
966 stylestr.find(
"boxes") == std::string::npos &&
967 stylestr.find(
"filledcurves") == std::string::npos &&
968 stylestr.find(
"histograms") == std::string::npos )
987 pstyle = std::string(
"points");
1004 if (stylestr.find(
"unique") == std::string::npos &&
1005 stylestr.find(
"frequency") == std::string::npos &&
1006 stylestr.find(
"csplines") == std::string::npos &&
1007 stylestr.find(
"acsplines") == std::string::npos &&
1008 stylestr.find(
"bezier") == std::string::npos &&
1009 stylestr.find(
"sbezier") == std::string::npos )
1029 cmd(
"set terminal " + Gnuplot::terminal_std);
1040 cmd(
"set terminal postscript color");
1042 std::ostringstream cmdstr;
1043 cmdstr <<
"set output \"" << filename <<
".ps\"";
1055 std::ostringstream cmdstr;
1056 cmdstr <<
"set key " << position;
1069 std::ostringstream cmdstr;
1071 cmdstr <<
"set logscale x " << base;
1083 std::ostringstream cmdstr;
1085 cmdstr <<
"set logscale y " << base;
1097 std::ostringstream cmdstr;
1099 cmdstr <<
"set logscale z " << base;
1111 std::ostringstream cmdstr;
1112 cmdstr <<
"set pointsize " << pointsize;
1124 std::ostringstream cmdstr;
1125 cmdstr <<
"set samples " << samples;
1138 std::ostringstream cmdstr;
1139 cmdstr <<
"set isosamples " << isolines;
1153 if (position.find(
"base") == std::string::npos &&
1154 position.find(
"surface") == std::string::npos &&
1155 position.find(
"both") == std::string::npos )
1157 cmd(
"set contour base");
1161 cmd(
"set contour " + position);
1174 std::ostringstream cmdstr;
1176 cmdstr <<
"set xlabel \"" << label <<
"\"";
1187 std::ostringstream cmdstr;
1189 cmdstr <<
"set ylabel \"" << label <<
"\"";
1200 std::ostringstream cmdstr;
1202 cmdstr <<
"set zlabel \"" << label <<
"\"";
1216 std::ostringstream cmdstr;
1218 cmdstr <<
"set xrange[" << iFrom <<
":" << iTo <<
"]";
1230 std::ostringstream cmdstr;
1232 cmdstr <<
"set yrange[" << iFrom <<
":" << iTo <<
"]";
1244 std::ostringstream cmdstr;
1246 cmdstr <<
"set zrange[" << iFrom <<
":" << iTo <<
"]";
1259 std::ostringstream cmdstr;
1261 cmdstr <<
"set cbrange[" << iFrom <<
":" << iTo <<
"]";
1274 const std::string &title)
1276 std::ostringstream cmdstr;
1280 if (nplots > 0 && two_dim ==
true)
1281 cmdstr <<
"replot ";
1285 cmdstr << a <<
" * x + " << b <<
" title \"";
1288 cmdstr <<
"f(x) = " << a <<
" * x + " << b;
1292 cmdstr <<
"\" with " << pstyle;
1307 const std::string &title)
1309 std::ostringstream cmdstr;
1313 if (nplots > 0 && two_dim ==
true)
1314 cmdstr <<
"replot ";
1318 cmdstr << equation <<
" title \"";
1321 cmdstr <<
"f(x) = " << equation;
1325 cmdstr <<
"\" with " << pstyle;
1340 const std::string &title)
1342 std::ostringstream cmdstr;
1346 if (nplots > 0 && two_dim ==
false)
1347 cmdstr <<
"replot ";
1351 cmdstr << equation <<
" title \"";
1354 cmdstr <<
"f(x,y) = " << equation;
1358 cmdstr <<
"\" with " << pstyle;
1374 const unsigned int column,
1375 const std::string &title)
1380 file_available(filename);
1383 std::ostringstream cmdstr;
1387 if (nplots > 0 && two_dim ==
true)
1388 cmdstr <<
"replot ";
1392 cmdstr <<
"\"" << filename <<
"\" using " << column;
1395 cmdstr <<
" notitle ";
1397 cmdstr <<
" title \"" << title <<
"\" ";
1400 cmdstr <<
"with " << pstyle;
1402 cmdstr <<
"smooth " << smooth;
1419 const unsigned int column_x,
1420 const unsigned int column_y,
1421 const std::string &title)
1426 file_available(filename);
1429 std::ostringstream cmdstr;
1433 if (nplots > 0 && two_dim ==
true)
1434 cmdstr <<
"replot ";
1438 cmdstr <<
"\"" << filename <<
"\" using " << column_x <<
":" << column_y;
1441 cmdstr <<
" notitle ";
1443 cmdstr <<
" title \"" << title <<
"\" ";
1446 cmdstr <<
"with " << pstyle;
1448 cmdstr <<
"smooth " << smooth;
1464 const unsigned int column_x,
1465 const unsigned int column_y,
1466 const unsigned int column_dy,
1467 const std::string &title)
1472 file_available(filename);
1474 std::ostringstream cmdstr;
1478 if (nplots > 0 && two_dim ==
true)
1479 cmdstr <<
"replot ";
1483 cmdstr <<
"\"" << filename <<
"\" using " 1484 << column_x <<
":" << column_y <<
":" << column_dy
1485 <<
" with errorbars ";
1488 cmdstr <<
" notitle ";
1490 cmdstr <<
" title \"" << title <<
"\" ";
1506 const unsigned int column_x,
1507 const unsigned int column_y,
1508 const unsigned int column_z,
1509 const std::string &title)
1514 file_available(filename);
1516 std::ostringstream cmdstr;
1520 if (nplots > 0 && two_dim ==
false)
1521 cmdstr <<
"replot ";
1525 cmdstr <<
"\"" << filename <<
"\" using " << column_x <<
":" << column_y
1529 cmdstr <<
" notitle with " << pstyle;
1531 cmdstr <<
" title \"" << title <<
"\" with " << pstyle;
1548 const unsigned int iWidth,
1549 const unsigned int iHeight,
1550 const std::string &title)
1553 std::string name = create_tmpfile(tmp);
1561 for(
unsigned iRow = 0; iRow < iHeight; ++iRow)
1563 for(
unsigned iColumn = 0; iColumn < iWidth; ++iColumn)
1565 tmp << iColumn <<
" " << iRow <<
" " 1566 <<
static_cast<float>(ucPicBuf[iIndex++]) << std::endl;
1574 std::ostringstream cmdstr;
1578 if (nplots > 0 && two_dim ==
true)
1579 cmdstr <<
"replot ";
1584 cmdstr <<
"\"" << name <<
"\" with image";
1586 cmdstr <<
"\"" << name <<
"\" title \"" << title <<
"\" with image";
1615 fputs( (cmdstr+
"\n").c_str(), gnucmd );
1625 if( cmdstr.find(
"replot") != std::string::npos )
1629 else if( cmdstr.find(
"splot") != std::string::npos )
1634 else if( cmdstr.find(
"plot") != std::string::npos )
1649 void Gnuplot::init()
1655 #if ( defined(unix) || defined(__unix) || defined(__unix__) ) && !defined(__APPLE__) 1656 if (getenv(
"DISPLAY") == NULL)
1665 if (!Gnuplot::get_program_path())
1675 std::string tmp = Gnuplot::m_sGNUPlotPath +
"/" +
1676 Gnuplot::m_sGNUPlotFileName;
1683 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 1684 gnucmd = _popen(tmp.c_str(),
"w");
1685 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 1686 gnucmd = popen(tmp.c_str(),
"w");
1713 bool Gnuplot::get_program_path()
1718 std::string tmp = Gnuplot::m_sGNUPlotPath +
"/" +
1719 Gnuplot::m_sGNUPlotFileName;
1721 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 1722 if ( Gnuplot::file_exists(tmp,0) )
1723 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 1724 if ( Gnuplot::file_exists(tmp,1) )
1736 path = getenv(
"PATH");
1746 std::list<std::string> ls;
1749 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 1750 stringtok(ls,path,
";");
1751 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 1752 stringtok(ls,path,
":");
1756 for (std::list<std::string>::const_iterator i = ls.begin();
1759 tmp = (*i) +
"/" + Gnuplot::m_sGNUPlotFileName;
1760 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 1761 if ( Gnuplot::file_exists(tmp,0) )
1762 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
1763 if ( Gnuplot::file_exists(tmp,1) )
1766 Gnuplot::m_sGNUPlotPath = *i;
1771 tmp =
"Can't find gnuplot neither in PATH nor in \"" +
1772 Gnuplot::m_sGNUPlotPath +
"\"";
1775 Gnuplot::m_sGNUPlotPath =
"";
1786 bool Gnuplot::file_exists(
const std::string &filename,
int mode)
1788 if ( mode < 0 || mode > 7)
1790 throw std::runtime_error(
"In function \"Gnuplot::file_exists\": mode\ 1791 has to be an integer between 0 and 7");
1805 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 1806 if (_access(filename.c_str(), mode) == 0)
1807 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 1808 if (access(filename.c_str(), mode) == 0)
1820 bool Gnuplot::file_available(
const std::string &filename){
1821 std::ostringstream except;
1822 if( Gnuplot::file_exists(filename,0) )
1824 if( !(Gnuplot::file_exists(filename,4)) ){
1825 except <<
"No read permission for File \"" << filename <<
"\"";
1831 except <<
"File \"" << filename <<
"\" does not exist";
1845 std::string Gnuplot::create_tmpfile(std::ofstream &tmp)
1848 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 1849 char name[] =
"gnuplotiXXXXXX";
1850 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) 1851 char name[] =
"/tmp/gnuplotiXXXXXX";
1857 if (Gnuplot::tmpfile_num == GP_MAX_TMP_FILES - 1)
1859 std::ostringstream except;
1860 except <<
"Maximum number of temporary files reached (" 1861 << GP_MAX_TMP_FILES <<
"): cannot open more files" << std::endl;
1881 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) 1882 if (_mktemp(name) == NULL)
1883 #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
1884 if (mkstemp(name) == -1)
1887 std::ostringstream except;
1888 except <<
"Cannot create temporary file \"" << name <<
"\"";
1896 std::ostringstream except;
1897 except <<
"Cannot create temporary file \"" << name <<
"\"";
1905 tmpfile_list.push_back(name);
1906 Gnuplot::tmpfile_num++;
1912 if ((tmpfile_list).size() > 0)
1914 for (
unsigned int i = 0; i < tmpfile_list.size(); i++)
1915 remove( tmpfile_list[i].c_str() );
1917 Gnuplot::tmpfile_num -= tmpfile_list.size();
Gnuplot & reset_all()
resets a gnuplot session and sets all variables to default
Definition: gnuplot_i.hpp:937
Gnuplot & plot_xyz(const X &x, const Y &y, const Z &z, const std::string &title="")
from std::vector
Definition: gnuplot_i.hpp:773
Gnuplot & set_style(const std::string &stylestr="points")
Definition: gnuplot_i.hpp:956
Gnuplot & operator<<(const std::string &cmdstr)
Sends a command to an active gnuplot session, identical to cmd() send a command to gnuplot using the ...
Definition: gnuplot_i.hpp:221
Gnuplot & set_yrange(const double iFrom, const double iTo)
set y-axis - ranges
Definition: gnuplot_i.hpp:1227
Gnuplot & set_isosamples(const int isolines=10)
set isoline density (grid) for plotting functions as surfaces (for 3d plots)
Definition: gnuplot_i.hpp:1136
Gnuplot & set_title(const std::string &title="")
sets and clears the title of a gnuplot session
Definition: gnuplot_i.hpp:348
A C++ interface to gnuplot.
Definition: gnuplot_i.hpp:60
Gnuplot & set_pointsize(const double pointsize=1.0)
scales the size of the points used in plots
Definition: gnuplot_i.hpp:1109
Gnuplot & unset_hidden3d()
Definition: gnuplot_i.hpp:302
Gnuplot & showonscreen()
sets terminal type to terminal_std
Definition: gnuplot_i.hpp:1026
The Gnuplot class, can receive parameters, then transmit them to Gnuplot via pipes Pipes are closed w...
Definition: gnuplot_i.hpp:75
Gnuplot & set_ylabel(const std::string &label="x")
set x axis label
Definition: gnuplot_i.hpp:1185
Gnuplot & plotfile_xy(const std::string &filename, const unsigned int column_x=1, const unsigned int column_y=2, const std::string &title="")
Definition: gnuplot_i.hpp:1418
Gnuplot & plotfile_x(const std::string &filename, const unsigned int column=1, const std::string &title="")
Definition: gnuplot_i.hpp:1373
Gnuplot & unset_xlogscale()
Definition: gnuplot_i.hpp:416
Gnuplot & set_xlabel(const std::string &label="y")
set y axis label
Definition: gnuplot_i.hpp:1172
Gnuplot & set_xautoscale()
Definition: gnuplot_i.hpp:387
Gnuplot & set_legend(const std::string &position="default")
Definition: gnuplot_i.hpp:1053
Gnuplot & set_zautoscale()
Definition: gnuplot_i.hpp:401
Gnuplot & set_xrange(const double iFrom, const double iTo)
set axis - ranges
Definition: gnuplot_i.hpp:1213
Gnuplot & set_smooth(const std::string &stylestr="csplines")
Definition: gnuplot_i.hpp:1002
Gnuplot & set_cbrange(const double iFrom, const double iTo)
set palette range (autoscale by default)
Definition: gnuplot_i.hpp:1256
Gnuplot & set_zrange(const double iFrom, const double iTo)
set z-axis - ranges
Definition: gnuplot_i.hpp:1241
Gnuplot & unset_smooth()
unset smooth attention: smooth is not set by default
Definition: gnuplot_i.hpp:258
Gnuplot & cmd(const std::string &cmdstr)
send a command to gnuplot
Definition: gnuplot_i.hpp:1602
Gnuplot & plot_xy(const X &x, const Y &y, const std::string &title="")
from data
Definition: gnuplot_i.hpp:688
Gnuplot & set_zlabel(const std::string &label="z")
set z axis label
Definition: gnuplot_i.hpp:1198
Gnuplot & plot_equation(const std::string &equation, const std::string &title="")
Definition: gnuplot_i.hpp:1306
Gnuplot & unset_legend()
Switches legend off attention:legend is set by default.
Definition: gnuplot_i.hpp:339
Gnuplot & set_yautoscale()
Definition: gnuplot_i.hpp:394
Gnuplot & unset_multiplot()
Definition: gnuplot_i.hpp:281
Gnuplot & savetops(const std::string &filename="gnuplot_output")
saves a gnuplot session to a postscript file, filename without extension
Definition: gnuplot_i.hpp:1038
static void set_terminal_std(const std::string &type)
Definition: gnuplot_i.hpp:845
Gnuplot & plot_slope(const double a, const double b, const std::string &title="")
plot an equation of the form: y = ax + b, you supply a and b
Definition: gnuplot_i.hpp:1272
Gnuplot & set_samples(const int samples=100)
set sampling rate of functions, or for interpolating data
Definition: gnuplot_i.hpp:1122
GnuplotException(const std::string &msg)
GnuplotException Class constructor.
Definition: gnuplot_i.hpp:67
Gnuplot & unset_surface()
Definition: gnuplot_i.hpp:326
Gnuplot & plot_equation3d(const std::string &equation, const std::string &title="")
Definition: gnuplot_i.hpp:1339
Gnuplot & reset_plot()
resets a gnuplot session (next plot will erase previous ones)
Definition: gnuplot_i.hpp:923
Gnuplot & unset_zlogscale()
Definition: gnuplot_i.hpp:430
Gnuplot & plot_x(const X &x, const std::string &title="")
from std::vector
Definition: gnuplot_i.hpp:654
Gnuplot & set_ylogscale(const double base=10)
turns on/off log scaling for the specified yaxis (logscale is not set by default) ...
Definition: gnuplot_i.hpp:1081
Gnuplot & set_hidden3d()
Definition: gnuplot_i.hpp:295
Gnuplot & set_grid()
turns grid on/off
Definition: gnuplot_i.hpp:265
Gnuplot & plot_xy_err(const X &x, const Y &y, const E &dy, const std::string &title="")
from data
Definition: gnuplot_i.hpp:728
Gnuplot & plotfile_xyz(const std::string &filename, const unsigned int column_x=1, const unsigned int column_y=2, const unsigned int column_z=3, const std::string &title="")
Definition: gnuplot_i.hpp:1505
Gnuplot & unset_ylogscale()
Definition: gnuplot_i.hpp:423
Gnuplot & replot(void)
replot repeats the last plot or splot command. this can be useful for viewing a plot with different s...
Definition: gnuplot_i.hpp:527
Gnuplot & unset_title()
Clears the title of a gnuplot session The title is not set by default.
Definition: gnuplot_i.hpp:364
Gnuplot & set_multiplot()
Definition: gnuplot_i.hpp:274
Gnuplot & plotfile_xy_err(const std::string &filename, const unsigned int column_x=1, const unsigned int column_y=2, const unsigned int column_dy=3, const std::string &title="")
Definition: gnuplot_i.hpp:1463
~Gnuplot()
destructor: needed to delete temporary files
Definition: gnuplot_i.hpp:905
bool is_valid()
Is the gnuplot session valid ??
Definition: gnuplot_i.hpp:543
void remove_tmpfiles()
deletes temporary files
Definition: gnuplot_i.hpp:1911
Gnuplot & set_surface()
Definition: gnuplot_i.hpp:318
Gnuplot & set_contour(const std::string &position="base")
Definition: gnuplot_i.hpp:1151
Gnuplot & set_xlogscale(const double base=10)
turns on/off log scaling for the specified xaxis (logscale is not set by default) ...
Definition: gnuplot_i.hpp:1067
Gnuplot(const std::string &style="points")
set a style during construction
Definition: gnuplot_i.hpp:573
static bool set_GNUPlotPath(const std::string &path)
optional function: set Gnuplot path manual attention: for windows: path with slash '/' not backslash ...
Definition: gnuplot_i.hpp:817
Gnuplot & plot_image(const unsigned char *ucPicBuf, const unsigned int iWidth, const unsigned int iHeight, const std::string &title="")
plot image
Definition: gnuplot_i.hpp:1547
Gnuplot & unset_grid()
grid is not set by default
Definition: gnuplot_i.hpp:267
Gnuplot & unset_contour()
Definition: gnuplot_i.hpp:311
Gnuplot & set_zlogscale(const double base=10)
turns on/off log scaling for the specified zaxis (logscale is not set by default) ...
Definition: gnuplot_i.hpp:1095