A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Gnuplot Class Reference

a simple class to generate gnuplot-ready plotting commands from a set of datasets. More...

#include "gnuplot.h"

+ Collaboration diagram for ns3::Gnuplot:

Public Member Functions

 Gnuplot (const std::string &outputFilename="", const std::string &title="")
 
 Gnuplot (const std::string &outputFilename="", const std::string &title="")
 
void AddDataset (const GnuplotDataset &dataset)
 
void AddDataset (const GnuplotDataset &dataset)
 
void AppendExtra (const std::string &extra)
 
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 &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 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 SetDataFileDatasetIndex (unsigned int index)
 Sets the current data stream index in the data file.
 
void SetExtra (const std::string &extra)
 
void SetExtra (const std::string &extra)
 
void SetLegend (const std::string &xLegend, const std::string &yLegend)
 
void SetLegend (const std::string &xLegend, const std::string &yLegend)
 
void SetOutputFilename (const std::string &outputFilename)
 
void SetOutputFilename (const std::string &outputFilename)
 
void SetTerminal (const std::string &terminal)
 
void SetTerminal (const std::string &terminal)
 
void SetTitle (const std::string &title)
 
void SetTitle (const std::string &title)
 

Static Public Member Functions

static std::string DetectTerminal (const std::string &filename)
 Crude attempt to auto-detect the correct terminal setting by inspecting the filename's extension.
 
static std::string DetectTerminal (const std::string &filename)
 Crude attempt to auto-detect the correct terminal setting by inspecting the filename's extension.
 

Private Types

typedef std::vector< GnuplotDatasetDatasets
 Type for Datasets to be used in plots.
 
typedef std::vector< GnuplotDatasetDatasets
 Type for Datasets to be used in plots.
 

Private Attributes

unsigned int m_dataFileDatasetIndex
 Data set index to plot.
 
Datasets m_datasets
 Data sets.
 
std::string m_extra
 extra parameters for the plot
 
bool m_generateOneOutputFile
 true if only one plot will be generated
 
std::string m_outputFilename
 Output file name.
 
std::string m_terminal
 Gnuplot "terminal" to use.
 
std::string m_title
 Plot title.
 
std::string m_xLegend
 X axis legend.
 
std::string m_yLegend
 Y axis legend.
 

Detailed Description

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.

Definition at line 359 of file gnuplot.h.

Member Typedef Documentation

◆ Datasets [1/2]

Type for Datasets to be used in plots.

Definition at line 450 of file gnuplot.h.

◆ Datasets [2/2]

Type for Datasets to be used in plots.

Definition at line 450 of file gnuplot_new.h.

Constructor & Destructor Documentation

◆ Gnuplot() [1/2]

ns3::Gnuplot::Gnuplot ( const std::string &  outputFilename = "",
const std::string &  title = "" 
)
Parameters
outputFilenamethe 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.
titletitle line of the plot page

Definition at line 719 of file gnuplot.cc.

◆ Gnuplot() [2/2]

ns3::Gnuplot::Gnuplot ( const std::string &  outputFilename = "",
const std::string &  title = "" 
)
Parameters
outputFilenamethe 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.
titletitle line of the plot page

Member Function Documentation

◆ AddDataset() [1/2]

void ns3::Gnuplot::AddDataset ( const GnuplotDataset dataset)
Parameters
datasetadd a dataset to the graph to be plotted.

Definition at line 788 of file gnuplot.cc.

References ns3::Create(), and m_datasets.

Referenced by ns3::GnuplotAggregator::Add2dDataset(), Ns3TcpCubicTestCase::DoRun(), ns3::QKDGraph::PrintGraph(), and ns3::QKDTotalGraph::PrintGraph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddDataset() [2/2]

void ns3::Gnuplot::AddDataset ( const GnuplotDataset dataset)
Parameters
datasetadd a dataset to the graph to be plotted.

◆ AppendExtra() [1/2]

void ns3::Gnuplot::AppendExtra ( const std::string &  extra)
Parameters
extraappend extra gnuplot directive for output.

Definition at line 781 of file gnuplot.cc.

References ns3::Create(), and m_extra.

Referenced by ns3::QKDGraph::QKDGraph(), ns3::GnuplotAggregator::~GnuplotAggregator(), ns3::GnuplotAggregator::AppendExtra(), ns3::QKDTotalGraph::Init(), ns3::QKDGraph::PrintGraph(), ns3::QKDTotalGraph::PrintGraph(), ns3::GnuplotAggregator::SetKeyLocation(), TestDeterministic(), TestDeterministicByTime(), and TestProbabilistic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AppendExtra() [2/2]

void ns3::Gnuplot::AppendExtra ( const std::string &  extra)
Parameters
extraappend extra gnuplot directive for output.

◆ DetectTerminal() [1/2]

std::string ns3::Gnuplot::DetectTerminal ( const std::string &  filename)
static

Crude attempt to auto-detect the correct terminal setting by inspecting the filename's extension.

Parameters
filenameoutput filename
Returns
File extension of the provided filename

Definition at line 735 of file gnuplot.cc.

References ns3::Create().

+ Here is the call graph for this function:

◆ DetectTerminal() [2/2]

static std::string ns3::Gnuplot::DetectTerminal ( const std::string &  filename)
static

Crude attempt to auto-detect the correct terminal setting by inspecting the filename's extension.

Parameters
filenameoutput filename
Returns
File extension of the provided filename

◆ GenerateOutput() [1/4]

void ns3::Gnuplot::GenerateOutput ( std::ostream &  os)

Writes gnuplot commands and data values to a single output stream.

Parameters
osthe output stream on which the relevant gnuplot commands should be generated. Including output file and terminal headers.

Definition at line 794 of file gnuplot.cc.

References GenerateOutput(), and m_generateOneOutputFile.

Referenced by ns3::GnuplotAggregator::~GnuplotAggregator(), Ns3TcpCubicTestCase::DoRun(), GenerateOutput(), ns3::GnuplotCollection::GenerateOutput(), ns3::QKDGraph::PrintGraph(), and ns3::QKDTotalGraph::PrintGraph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GenerateOutput() [2/4]

void ns3::Gnuplot::GenerateOutput ( std::ostream &  os)

Writes gnuplot commands and data values to a single output stream.

Parameters
osthe output stream on which the relevant gnuplot commands should be generated. Including output file and terminal headers.

◆ GenerateOutput() [3/4]

void ns3::Gnuplot::GenerateOutput ( std::ostream &  osControl,
std::ostream &  osData,
std::string  dataFileName 
)

Writes gnuplot commands and data values to two different outputs streams.

Parameters
osControlthe output stream on which the relevant gnuplot control commands should be generated. Including output file and terminal headers.
osDatathe output stream on which the relevant gnuplot data values should be generated.
dataFileNamethe name for the data file that will be written.

Definition at line 805 of file gnuplot.cc.

References ns3::Create(), m_dataFileDatasetIndex, m_datasets, m_extra, m_generateOneOutputFile, m_outputFilename, m_terminal, m_title, m_xLegend, m_yLegend, and NS_ASSERT_MSG.

+ Here is the call graph for this function:

◆ GenerateOutput() [4/4]

void ns3::Gnuplot::GenerateOutput ( std::ostream &  osControl,
std::ostream &  osData,
std::string  dataFileName 
)

Writes gnuplot commands and data values to two different outputs streams.

Parameters
osControlthe output stream on which the relevant gnuplot control commands should be generated. Including output file and terminal headers.
osDatathe output stream on which the relevant gnuplot data values should be generated.
dataFileNamethe name for the data file that will be written.

◆ SetDataFileDatasetIndex() [1/2]

void ns3::Gnuplot::SetDataFileDatasetIndex ( unsigned int  index)

Sets the current data stream index in the data file.

Parameters
indexthe index for the data stream in the data file.

Definition at line 891 of file gnuplot.cc.

References m_dataFileDatasetIndex.

◆ SetDataFileDatasetIndex() [2/2]

void ns3::Gnuplot::SetDataFileDatasetIndex ( unsigned int  index)

Sets the current data stream index in the data file.

Parameters
indexthe index for the data stream in the data file.

◆ SetExtra() [1/2]

void ns3::Gnuplot::SetExtra ( const std::string &  extra)
Parameters
extraset extra gnuplot directive for output.

Definition at line 775 of file gnuplot.cc.

References ns3::Create(), and m_extra.

Referenced by ns3::GnuplotAggregator::SetExtra().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetExtra() [2/2]

void ns3::Gnuplot::SetExtra ( const std::string &  extra)
Parameters
extraset extra gnuplot directive for output.

◆ SetLegend() [1/2]

void ns3::Gnuplot::SetLegend ( const std::string &  xLegend,
const std::string &  yLegend 
)
Parameters
xLegendthe legend for the x horizontal axis
yLegendthe legend for the y vertical axis

Definition at line 768 of file gnuplot.cc.

References ns3::Create(), m_xLegend, and m_yLegend.

Referenced by ns3::QKDGraph::QKDGraph(), Ns3TcpCubicTestCase::DoRun(), ns3::QKDTotalGraph::Init(), and ns3::GnuplotAggregator::SetLegend().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetLegend() [2/2]

void ns3::Gnuplot::SetLegend ( const std::string &  xLegend,
const std::string &  yLegend 
)
Parameters
xLegendthe legend for the x horizontal axis
yLegendthe legend for the y vertical axis

◆ SetOutputFilename() [1/2]

void ns3::Gnuplot::SetOutputFilename ( const std::string &  outputFilename)
Parameters
outputFilenamethe 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 729 of file gnuplot.cc.

References ns3::Create(), and m_outputFilename.

Referenced by ns3::QKDGraph::QKDGraph(), ns3::QKDTotalGraph::Init(), and ns3::GnuplotAggregator::SetTerminal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetOutputFilename() [2/2]

void ns3::Gnuplot::SetOutputFilename ( const std::string &  outputFilename)
Parameters
outputFilenamethe 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.

◆ SetTerminal() [1/2]

void ns3::Gnuplot::SetTerminal ( const std::string &  terminal)
Parameters
terminalterminal setting string for output. The default terminal string is "png"

Definition at line 756 of file gnuplot.cc.

References ns3::Create(), and m_terminal.

Referenced by Ns3TcpCubicTestCase::DoRun(), and ns3::GnuplotAggregator::SetTerminal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTerminal() [2/2]

void ns3::Gnuplot::SetTerminal ( const std::string &  terminal)
Parameters
terminalterminal setting string for output. The default terminal string is "png"

◆ SetTitle() [1/2]

void ns3::Gnuplot::SetTitle ( const std::string &  title)
Parameters
titleset new plot title string to use for this plot.

Definition at line 762 of file gnuplot.cc.

References m_title.

Referenced by ns3::QKDGraph::QKDGraph(), ns3::QKDTotalGraph::Init(), and ns3::GnuplotAggregator::SetTitle().

+ Here is the caller graph for this function:

◆ SetTitle() [2/2]

void ns3::Gnuplot::SetTitle ( const std::string &  title)
Parameters
titleset new plot title string to use for this plot.

Member Data Documentation

◆ m_dataFileDatasetIndex

unsigned int ns3::Gnuplot::m_dataFileDatasetIndex
private

Data set index to plot.

Definition at line 464 of file gnuplot.h.

Referenced by GenerateOutput(), and SetDataFileDatasetIndex().

◆ m_datasets

Datasets ns3::Gnuplot::m_datasets
private

Data sets.

Definition at line 455 of file gnuplot.h.

Referenced by AddDataset(), and GenerateOutput().

◆ m_extra

std::string ns3::Gnuplot::m_extra
private

extra parameters for the plot

Definition at line 460 of file gnuplot.h.

Referenced by AppendExtra(), GenerateOutput(), and SetExtra().

◆ m_generateOneOutputFile

bool ns3::Gnuplot::m_generateOneOutputFile
private

true if only one plot will be generated

Definition at line 462 of file gnuplot.h.

Referenced by GenerateOutput(), and GenerateOutput().

◆ m_outputFilename

std::string ns3::Gnuplot::m_outputFilename
private

Output file name.

Definition at line 452 of file gnuplot.h.

Referenced by GenerateOutput(), and SetOutputFilename().

◆ m_terminal

std::string ns3::Gnuplot::m_terminal
private

Gnuplot "terminal" to use.

Definition at line 453 of file gnuplot.h.

Referenced by GenerateOutput(), and SetTerminal().

◆ m_title

std::string ns3::Gnuplot::m_title
private

Plot title.

Definition at line 457 of file gnuplot.h.

Referenced by GenerateOutput(), and SetTitle().

◆ m_xLegend

std::string ns3::Gnuplot::m_xLegend
private

X axis legend.

Definition at line 458 of file gnuplot.h.

Referenced by GenerateOutput(), and SetLegend().

◆ m_yLegend

std::string ns3::Gnuplot::m_yLegend
private

Y axis legend.

Definition at line 459 of file gnuplot.h.

Referenced by GenerateOutput(), and SetLegend().


The documentation for this class was generated from the following files: