22 #include "ns3/assert.h"
42 Data(
const std::string& title);
69 m_extra (m_defaultExtra)
87 : m_data (original.m_data)
100 if (
this != &original)
142 Data2d(
const std::string& title);
151 m_style (m_defaultStyle),
152 m_errorBars (m_defaultErrorBars)
168 os <<
" title '" << m_title <<
"'";
178 os <<
" with points";
181 os <<
" with xerrorbars";
184 os <<
" with yerrorbars";
187 os <<
" with xyerrorbars";
195 os <<
" with linespoints";
198 os <<
" with errorlines";
201 os <<
" with yerrorlines";
204 os <<
" with xyerrorlines";
212 os <<
" with impulses";
218 os <<
" with fsteps";
221 os <<
" with histeps";
226 os <<
" " << m_extra;
232 for (PointSet::const_iterator i = m_pointset.begin ();
233 i != m_pointset.end (); ++i)
240 switch (m_errorBars) {
242 os << i->x <<
" " << i->y << std::endl;
245 os << i->x <<
" " << i->y <<
" " << i->dx << std::endl;
248 os << i->x <<
" " << i->y <<
" " << i->dy << std::endl;
251 os << i->x <<
" " << i->y <<
" " << i->dx <<
" " << i->dy << std::endl;
255 os <<
"e" << std::endl;
287 reinterpret_cast<Data2d*
>(
m_data)->m_errorBars = errorBars;
301 reinterpret_cast<Data2d*
>(
m_data)->m_pointset.push_back (data);
308 reinterpret_cast<Data2d*>(
m_data)->m_errorBars ==
Y );
314 data.
dx = errorDelta;
315 data.
dy = errorDelta;
316 reinterpret_cast<Data2d*
>(
m_data)->m_pointset.push_back (data);
328 data.
dx = xErrorDelta;
329 data.
dy = yErrorDelta;
330 reinterpret_cast<Data2d*
>(
m_data)->m_pointset.push_back (data);
338 reinterpret_cast<Data2d*
>(
m_data)->m_pointset.push_back (data);
352 Function2d(
const std::string& title,
const std::string&
function);
361 m_function (function)
377 os <<
" title '" << m_title <<
"'";
380 os <<
" " << m_extra;
414 Data3d(
const std::string& title);
423 m_style (m_defaultStyle)
439 os <<
" " << m_style;
442 os <<
" title '" << m_title <<
"'";
445 os <<
" " << m_extra;
451 for (PointSet::const_iterator i = m_pointset.begin ();
452 i != m_pointset.end (); ++i)
459 os << i->x <<
" " << i->y <<
" " << i->z << std::endl;
461 os <<
"e" << std::endl;
492 reinterpret_cast<Data3d*
>(
m_data)->m_pointset.push_back (data);
500 reinterpret_cast<Data3d*
>(
m_data)->m_pointset.push_back (data);
514 Function3d(
const std::string& title,
const std::string&
function);
523 m_function (function)
539 os <<
" title '" << m_title <<
"'";
542 os <<
" " << m_extra;
566 : m_outputFilename (outputFilename),
567 m_terminal ( DetectTerminal (outputFilename) ),
574 std::string::size_type dotpos = filename.rfind (
'.');
575 if (dotpos == std::string::npos)
return "";
577 if (filename.substr (dotpos) ==
".png") {
580 else if (filename.substr (dotpos) ==
".pdf") {
629 os <<
"set terminal " <<
m_terminal << std::endl;
635 os <<
"set title '" <<
m_title <<
"'" << std::endl;
638 os <<
"set xlabel '" <<
m_xLegend <<
"'" << std::endl;
641 os <<
"set ylabel '" <<
m_yLegend <<
"'" << std::endl;
652 std::string command =
m_datasets.begin ()->m_data->GetCommand ();
654 for (Datasets::const_iterator i =
m_datasets.begin () + 1;
658 "Cannot mix 'plot' and 'splot' GnuplotDatasets.");
661 os << command <<
" ";
667 i->m_data->PrintExpression (os);
682 i->m_data->PrintDatafile (os);
689 : m_outputFilename (outputFilename),
690 m_terminal (
Gnuplot::DetectTerminal (outputFilename) )
710 throw(std::range_error (
"Gnuplot id is out of range"));
719 os <<
"set terminal " <<
m_terminal << std::endl;
724 for (Plots::const_iterator i =
m_plots.begin (); i !=
m_plots.end (); ++i)
726 i->GenerateOutput (os);