a simple class to generate gnuplot-ready plotting commands from a set of datasets. More...
#include <gnuplot.h>
Public Member Functions | |
Gnuplot (const std::string &outputFilename="", const std::string &title="") | |
void | AddDataset (const GnuplotDataset &dataset) |
void | AppendExtra (const std::string &extra) |
void | GenerateOutput (std::ostream &os) |
Writes gnuplot commands and data values to a single output stream. | |
void | GenerateOutput (std::ostream &osControl, std::ostream &osData, std::string dataFileName) |
Writes gnuplot commands and data values to two different outputs streams. | |
void | SetDataFileDatasetIndex (unsigned int index) |
Sets the current data stream index in the data file. | |
void | SetExtra (const std::string &extra) |
void | SetLegend (const std::string &xLegend, const std::string &yLegend) |
void | SetOutputFilename (const std::string &outputFilename) |
void | SetTerminal (const std::string &terminal) |
void | SetTitle (const std::string &title) |
Static Public Member Functions | |
static std::string | DetectTerminal (const std::string &filename) |
Private Types | |
typedef std::vector < GnuplotDataset > | Datasets |
Private Attributes | |
unsigned int | m_dataFileDatasetIndex |
Datasets | m_datasets |
std::string | m_extra |
bool | m_generateOneOutputFile |
std::string | m_outputFilename |
std::string | m_terminal |
std::string | m_title |
std::string | m_xLegend |
std::string | m_yLegend |
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
This class really represents a single graph on which multiple datasets can be plotted.
|
private |
ns3::Gnuplot::Gnuplot | ( | const std::string & | outputFilename = "" , |
const std::string & | title = "" |
||
) |
outputFilename | the name of the file where the rendering of the graph will be generated if you feed the command stream output by Gnuplot::GenerateOutput to the gnuplot program. |
title | title line of the plot page |
Definition at line 650 of file gnuplot.cc.
void ns3::Gnuplot::AddDataset | ( | const GnuplotDataset & | dataset | ) |
dataset | add a dataset to the graph to be plotted. |
Definition at line 712 of file gnuplot.cc.
References m_datasets.
Referenced by ns3::GnuplotAggregator::Add2dDataset(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile(), anonymous_namespace{gnuplot-example.cc}::Create3DPlotFile(), and main().
void ns3::Gnuplot::AppendExtra | ( | const std::string & | extra | ) |
extra | append extra gnuplot directive for output. |
Definition at line 705 of file gnuplot.cc.
References m_extra.
Referenced by ns3::GnuplotAggregator::AppendExtra(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile(), anonymous_namespace{gnuplot-example.cc}::Create3DPlotFile(), main(), ns3::GnuplotAggregator::SetKeyLocation(), TestDeterministic(), TestDeterministicByTime(), TestProbabilistic(), and ns3::GnuplotAggregator::~GnuplotAggregator().
|
static |
Crude attempt to auto-detect the correct terminal setting by inspecting the filename's extension.
filename | output file name |
Definition at line 664 of file gnuplot.cc.
void ns3::Gnuplot::GenerateOutput | ( | std::ostream & | os | ) |
Writes gnuplot commands and data values to a single output stream.
os | the output stream on which the relevant gnuplot commands should be generated. Including output file and terminal headers. |
Definition at line 718 of file gnuplot.cc.
References m_generateOneOutputFile.
Referenced by anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile(), anonymous_namespace{gnuplot-example.cc}::Create3DPlotFile(), main(), and ns3::GnuplotAggregator::~GnuplotAggregator().
void ns3::Gnuplot::GenerateOutput | ( | std::ostream & | osControl, |
std::ostream & | osData, | ||
std::string | dataFileName | ||
) |
Writes gnuplot commands and data values to two different outputs streams.
osControl | the output stream on which the relevant gnuplot contol commands should be generated. Including output file and terminal headers. |
osData | the output stream on which the relevant gnuplot data values should be generated. |
dataFileName | the name for the data file that will be written. |
Definition at line 729 of file gnuplot.cc.
References m_dataFileDatasetIndex, m_datasets, m_extra, m_generateOneOutputFile, m_outputFilename, m_terminal, m_title, m_xLegend, m_yLegend, and NS_ASSERT_MSG.
void ns3::Gnuplot::SetDataFileDatasetIndex | ( | unsigned int | index | ) |
Sets the current data stream index in the data file.
index | the index for the data stream in the data file. |
Definition at line 804 of file gnuplot.cc.
References m_dataFileDatasetIndex.
void ns3::Gnuplot::SetExtra | ( | const std::string & | extra | ) |
extra | set extra gnuplot directive for output. |
Definition at line 699 of file gnuplot.cc.
References m_extra.
Referenced by main(), and ns3::GnuplotAggregator::SetExtra().
void ns3::Gnuplot::SetLegend | ( | const std::string & | xLegend, |
const std::string & | yLegend | ||
) |
xLegend | the legend for the x horizontal axis |
yLegend | the legend for the y vertical axis |
Definition at line 692 of file gnuplot.cc.
References m_xLegend, and m_yLegend.
Referenced by anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile(), main(), and ns3::GnuplotAggregator::SetLegend().
void ns3::Gnuplot::SetOutputFilename | ( | const std::string & | outputFilename | ) |
outputFilename | the name of the file where the rendering of the graph will be generated if you feed the command stream output by Gnuplot::GenerateOutput to the gnuplot program. |
Definition at line 659 of file gnuplot.cc.
References m_outputFilename.
Referenced by ns3::GnuplotAggregator::SetTerminal().
void ns3::Gnuplot::SetTerminal | ( | const std::string & | terminal | ) |
terminal | terminal setting string for output. The default terminal string is "png" |
Definition at line 680 of file gnuplot.cc.
References m_terminal.
Referenced by anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile(), anonymous_namespace{gnuplot-example.cc}::Create3DPlotFile(), main(), and ns3::GnuplotAggregator::SetTerminal().
void ns3::Gnuplot::SetTitle | ( | const std::string & | title | ) |
title | set new plot title string to use for this plot. |
Definition at line 686 of file gnuplot.cc.
References m_title.
Referenced by anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile(), anonymous_namespace{gnuplot-example.cc}::Create3DPlotFile(), main(), and ns3::GnuplotAggregator::SetTitle().
|
private |
Definition at line 448 of file gnuplot.h.
Referenced by GenerateOutput(), and SetDataFileDatasetIndex().
|
private |
Definition at line 439 of file gnuplot.h.
Referenced by AddDataset(), and GenerateOutput().
|
private |
Definition at line 444 of file gnuplot.h.
Referenced by AppendExtra(), GenerateOutput(), and SetExtra().
|
private |
Definition at line 446 of file gnuplot.h.
Referenced by GenerateOutput().
|
private |
Definition at line 436 of file gnuplot.h.
Referenced by GenerateOutput(), and SetOutputFilename().
|
private |
Definition at line 437 of file gnuplot.h.
Referenced by GenerateOutput(), and SetTerminal().
|
private |
Definition at line 441 of file gnuplot.h.
Referenced by GenerateOutput(), and SetTitle().
|
private |
Definition at line 442 of file gnuplot.h.
Referenced by GenerateOutput(), and SetLegend().
|
private |
Definition at line 443 of file gnuplot.h.
Referenced by GenerateOutput(), and SetLegend().