18 std::string
const& pathToGnuplotExecutable,
19 std::string
const& plotFileName ) :
20 plotFileName( plotFileName ),
21 gnuplotDataFileName(
"gnuplot_data.txt" ),
22 gnuplotCommandFileName(
"gnuplot_input.txt" ),
23 patienceTicks( 10000 ),
26 gnuplotExecutor( pathToGnuplotExecutable,
43 std::string
const xAxisLabel,
44 std::string
const yAxisLabel )
50 for(
int dataIndex( 0 );
56 <<
dataPoints[ dataIndex ].second << std::endl;
65 <<
"set term postscript eps enhanced color solid" << std::endl
67 <<
"set style line 1 lt rgb \"red\" lw 3" << std::endl
68 <<
"set ylabel \"" << yAxisLabel <<
"\"" << std::endl
69 <<
"set xlabel \"" << xAxisLabel <<
"\"" << std::endl
71 << legendString <<
"\" with lines ls 1" << std::endl;
80 <<
"BOL::error! TwoDimensionalDataPlotter::plotData() could not open"
82 std::cout << std::endl;
89 <<
"BOL::error! TwoDimensionalDataPlotter::plotData() could not open"
91 std::cout << std::endl;
97 std::vector< DoublePairVectorWithString >
const& dataAndColors,
98 std::string
const xAxisLabel,
99 std::string
const yAxisLabel )
101 std::string dataFileName;
103 dataAndColors.size() ) );
105 std::vector< std::pair< std::string, std::string > > colorsWithFilenames;
106 for(
size_t whichEntry( 0 );
107 dataAndColors.size() > whichEntry;
112 numberOfFileNumberDigits,
114 colorsWithFilenames.push_back( std::pair< std::string, std::string >(
115 dataAndColors[ whichEntry ].second,
122 for(
unsigned int dataIndex( 0 );
123 dataAndColors[ whichEntry ].first.size() > dataIndex;
127 << dataAndColors[ whichEntry ].first[ dataIndex ].first <<
" "
128 << dataAndColors[ whichEntry ].first[ dataIndex ].second
137 <<
"BOL::error! TwoDimensionalDataPlotter::plotData() could not open"
139 std::cout << std::endl;
148 <<
"set term postscript eps enhanced color solid" << std::endl
149 <<
"set ylabel \"" << yAxisLabel <<
"\"" << std::endl
150 <<
"set xlabel \"" << xAxisLabel <<
"\"" << std::endl
151 <<
"set output \"" <<
plotFileName <<
"\"" << std::endl;
152 for(
size_t whichEntry( 0 );
153 colorsWithFilenames.size() > whichEntry;
157 <<
"set style line " << ( whichEntry + 1 ) <<
" lt rgb \""
158 << colorsWithFilenames[ whichEntry ].first <<
"\" lw 3"
163 for(
size_t whichEntry( 0 );
164 colorsWithFilenames.size() > whichEntry;
172 <<
"'" << colorsWithFilenames[ whichEntry ].second
173 <<
"' index 0 notitle with lines ls " << ( whichEntry + 1 );
183 <<
"BOL::error! TwoDimensionalDataPlotter::plotData() could not open"
185 std::cout << std::endl;
192 std::string
const xAxisLabel,
193 std::string
const yAxisLabel )
195 std::string dataFileName;
197 dataAndColorsAndLabels.size() ) );
198 size_t numberOfFiles( dataAndColorsAndLabels.size() );
200 std::vector< std::string > dataFileNames;
201 for(
size_t whichEntry( 0 );
202 whichEntry < numberOfFiles;
207 numberOfFileNumberDigits,
209 dataFileNames.push_back( dataFileName );
214 for(
size_t dataIndex( 0 );
215 dataAndColorsAndLabels[ whichEntry ].first.size() > dataIndex;
219 << dataAndColorsAndLabels[ whichEntry ].first[ dataIndex ].first
221 << dataAndColorsAndLabels[ whichEntry ].first[ dataIndex ].second
230 <<
"BOL::error! TwoDimensionalDataPlotter::plotData() could not open"
232 std::cout << std::endl;
241 <<
"set term postscript eps enhanced color solid" << std::endl
242 <<
"set ylabel \"" << yAxisLabel <<
"\"" << std::endl
243 <<
"set xlabel \"" << xAxisLabel <<
"\"" << std::endl
244 <<
"set output \"" <<
plotFileName <<
"\"" << std::endl;
245 for(
size_t whichEntry( 0 );
246 whichEntry < numberOfFiles;
250 <<
"set style line " << ( whichEntry + 1 ) <<
" lt rgb \""
251 << dataAndColorsAndLabels[ whichEntry ].second.first <<
"\" lw 3"
256 for(
size_t whichEntry( 0 );
257 whichEntry < numberOfFiles;
265 <<
"'" << dataFileNames[ whichEntry ]
266 <<
"' index 0 title \""
267 << dataAndColorsAndLabels[ whichEntry ].second.second
268 <<
"\" with lines ls " << ( whichEntry + 1 );
278 <<
"BOL::error! TwoDimensionalDataPlotter::plotData() could not open"
280 std::cout << std::endl;
static std::string intToString(int inputInt, int const minimumNumberOfDigits, std::string const prefixForPositiveNumbers="+", std::string const prefixForNegativeNumbers="-", char const paddingChar='0')
static int numberOfDigitsInInt(int inputInt)
std::string const gnuplotCommandFileName
~TwoDimensionalDataPlotter()
std::vector< DoublePairVectorWithStringPair > PlotDataVector
std::ofstream outputStream
void plotData(std::string const legendString="", std::string const xAxisLabel="", std::string const yAxisLabel="")
WaitingOnSubprocessExecutor gnuplotExecutor
VectorlikeArray< std::pair< double, double > > dataPoints
TwoDimensionalDataPlotter(std::string const &pathToGnuplotExecutable, std::string const &plotFileName)
std::string const gnuplotDataFileName
bool forkAndExecvAndWait()
void setArguments(std::string const &argumentsAsSingleString)