A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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="")
void AddDataset (const GnuplotDataset &dataset)
void AppendExtra (const std::string &extra)
void GenerateOutput (std::ostream &os) const
void SetExtra (const std::string &extra)
void SetLegend (const std::string &xLegend, const std::string &yLegend)
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

Datasets m_datasets
std::string m_extra
std::string m_outputFilename
std::string m_terminal
std::string m_title
std::string m_xLegend
std::string m_yLegend

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 343 of file gnuplot.h.

Member Typedef Documentation

typedef std::vector<GnuplotDataset> ns3::Gnuplot::Datasets
private

Definition at line 400 of file gnuplot.h.

Constructor & Destructor Documentation

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 565 of file gnuplot.cc.

Member Function Documentation

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

Definition at line 620 of file gnuplot.cc.

References m_datasets.

Referenced by anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile(), anonymous_namespace{gnuplot-example.cc}::Create3DPlotFile(), and main().

+ Here is the caller graph for this function:

void ns3::Gnuplot::AppendExtra ( const std::string &  extra)
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 file name

Definition at line 572 of file gnuplot.cc.

void ns3::Gnuplot::GenerateOutput ( std::ostream &  os) const
Parameters
osthe output stream on which the relevant gnuplot commands should be generated. Including output file and terminal headers.

Definition at line 626 of file gnuplot.cc.

References m_datasets, m_extra, m_outputFilename, m_terminal, m_title, m_xLegend, m_yLegend, and NS_ASSERT_MSG.

Referenced by anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile(), anonymous_namespace{gnuplot-example.cc}::Create3DPlotFile(), and main().

+ Here is the caller graph for this function:

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

Definition at line 607 of file gnuplot.cc.

References m_extra.

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 600 of file gnuplot.cc.

References m_xLegend, and m_yLegend.

Referenced by anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), and anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile().

+ Here is the caller graph for this function:

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

Definition at line 588 of file gnuplot.cc.

References m_terminal.

Referenced by anonymous_namespace{gnuplot-example.cc}::Create2DPlotFile(), anonymous_namespace{gnuplot-example.cc}::Create2DPlotWithErrorBarsFile(), and anonymous_namespace{gnuplot-example.cc}::Create3DPlotFile().

+ Here is the caller graph for this function:

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

Definition at line 594 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(), and main().

+ Here is the caller graph for this function:

Member Data Documentation

Datasets ns3::Gnuplot::m_datasets
private

Definition at line 405 of file gnuplot.h.

Referenced by AddDataset(), and GenerateOutput().

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

Definition at line 410 of file gnuplot.h.

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

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

Definition at line 402 of file gnuplot.h.

Referenced by GenerateOutput().

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

Definition at line 403 of file gnuplot.h.

Referenced by GenerateOutput(), and SetTerminal().

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

Definition at line 407 of file gnuplot.h.

Referenced by GenerateOutput(), and SetTitle().

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

Definition at line 408 of file gnuplot.h.

Referenced by GenerateOutput(), and SetLegend().

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

Definition at line 409 of file gnuplot.h.

Referenced by GenerateOutput(), and SetLegend().


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