diff --git a/lib/Core/Plot.cpp b/lib/Core/Plot.cpp index 1909603..54b3721 100644 --- a/lib/Core/Plot.cpp +++ b/lib/Core/Plot.cpp @@ -683,7 +683,7 @@ void Plot::display(void) } } -void Plot::save(string dirName) +void Plot::save(string dirName, bool savePdf) { vector commandBack; string path, terminalBack, outputBack, gpCommand, scriptName; @@ -691,11 +691,6 @@ void Plot::save(string dirName) ofstream script; mode755 = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; - - // backup I/O parameters - terminalBack = options_.terminal; - outputBack = options_.output; - commandBack = plotCommand_; // generate directory if (mkdir(dirName)) @@ -703,12 +698,20 @@ void Plot::save(string dirName) LATAN_ERROR(Io, "impossible to create directory '" + dirName + "'"); } + // backup I/O parameters + terminalBack = options_.terminal; + outputBack = options_.output; + commandBack = plotCommand_; + // save PDF - options_.terminal = "pdf"; - options_.output = dirName + "/plot.pdf"; - display(); - options_.terminal = terminalBack; - options_.output = outputBack; + if (savePdf) + { + options_.terminal = "pdf"; + options_.output = dirName + "/plot.pdf"; + display(); + options_.terminal = terminalBack; + options_.output = outputBack; + } // save script and datafiles for (unsigned int i = 0; i < tmpFileName_.size(); ++i) diff --git a/lib/Core/Plot.hpp b/lib/Core/Plot.hpp index 26b1f20..bbc1c47 100644 --- a/lib/Core/Plot.hpp +++ b/lib/Core/Plot.hpp @@ -377,7 +377,7 @@ public: Plot & operator<<(PlotModifier &&modifier); // plot parsing and output void display(void); - void save(std::string dirName); + void save(std::string dirName, bool savePdf = true); friend std::ostream & operator<<(std::ostream &out, const Plot &plot); // plot reset void reset(void);