A Discrete-Event Network Simulator
API
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Static Private Attributes | List of all members
ns3::Gnuplot2dDataset Class Reference

Class to represent a 2D points plot. More...

#include "gnuplot.h"

+ Inheritance diagram for ns3::Gnuplot2dDataset:

Classes

struct  Data2d
 Structure storing the data to for a 2D plot. More...
 
struct  Point
 A point in a 2D plot. More...
 

Public Types

enum  ErrorBars { NONE, X, Y, XY }
 Whether errorbars should be used for this dataset. More...
 
enum  Style {
  LINES, POINTS, LINES_POINTS, DOTS,
  IMPULSES, STEPS, FSTEPS, HISTEPS
}
 The plotting style to use for this dataset. More...
 

Public Member Functions

 Gnuplot2dDataset (const std::string &title="Untitled")
 
void Add (double x, double y)
 
void Add (double x, double y, double errorDelta)
 
void Add (double x, double y, double xErrorDelta, double yErrorDelta)
 
void AddEmptyLine ()
 Add an empty line in the data output sequence. More...
 
void SetErrorBars (enum ErrorBars errorBars)
 
void SetStyle (enum Style style)
 
- Public Member Functions inherited from ns3::GnuplotDataset
 GnuplotDataset (const GnuplotDataset &original)
 Reference-counting copy constructor. More...
 
 ~GnuplotDataset ()
 Reference-counting destructor. More...
 
GnuplotDatasetoperator= (const GnuplotDataset &original)
 Reference-counting assignment operator. More...
 
void SetExtra (const std::string &extra)
 Add extra formatting parameters to this dataset. More...
 
void SetTitle (const std::string &title)
 Change line title. More...
 

Static Public Member Functions

static void SetDefaultErrorBars (enum ErrorBars errorBars)
 Change default errorbars style for all newly created objects. More...
 
static void SetDefaultStyle (enum Style style)
 Change default style for all newly created objects. More...
 
- Static Public Member Functions inherited from ns3::GnuplotDataset
static void SetDefaultExtra (const std::string &extra)
 Change extra formatting style parameters for newly created objects. More...
 

Private Types

typedef std::vector< struct PointPointSet
 The set of points in the dataset. More...
 

Static Private Attributes

static enum ErrorBars m_defaultErrorBars
 default error bars type More...
 
static enum Style m_defaultStyle
 default plot style More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::GnuplotDataset
 GnuplotDataset (struct Data *data)
 Called by constructors of derived classes. More...
 
- Protected Attributes inherited from ns3::GnuplotDataset
struct Datam_data
 Reference counted data object. More...
 
- Static Protected Attributes inherited from ns3::GnuplotDataset
static std::string m_defaultExtra = ""
 Extra gnuplot parameters set on every newly created dataset. More...
 

Detailed Description

Class to represent a 2D points plot.

Set the line or points style using SetStyle() and set points using Add().

Definition at line 117 of file gnuplot.h.

Member Typedef Documentation

◆ PointSet

typedef std::vector<struct Point> ns3::Gnuplot2dDataset::PointSet
private

The set of points in the dataset.

Definition at line 226 of file gnuplot.h.

Member Enumeration Documentation

◆ ErrorBars

Whether errorbars should be used for this dataset.

Enumerator
NONE 
XY 

Definition at line 137 of file gnuplot.h.

◆ Style

The plotting style to use for this dataset.

Enumerator
LINES 
POINTS 
LINES_POINTS 
DOTS 
IMPULSES 
STEPS 
FSTEPS 
HISTEPS 

Definition at line 123 of file gnuplot.h.

Constructor & Destructor Documentation

◆ Gnuplot2dDataset()

ns3::Gnuplot2dDataset::Gnuplot2dDataset ( const std::string &  title = "Untitled")
Parameters
titlethe title to be associated to this dataset.

Create an empty dataset. Usually, the dataset's title is displayed in the legend box.

Definition at line 331 of file gnuplot.cc.

Member Function Documentation

◆ Add() [1/3]

void ns3::Gnuplot2dDataset::Add ( double  x,
double  y 
)

◆ Add() [2/3]

void ns3::Gnuplot2dDataset::Add ( double  x,
double  y,
double  errorDelta 
)
Parameters
xx coord to new data point
yy coord to new data point
errorDeltax and y data point uncertainty

Use this method with error bar style X or Y.

Definition at line 373 of file gnuplot.cc.

References data, ns3::GnuplotDataset::m_data, NS_ASSERT, sample-rng-plot::x, X, and Y.

◆ Add() [3/3]

void ns3::Gnuplot2dDataset::Add ( double  x,
double  y,
double  xErrorDelta,
double  yErrorDelta 
)
Parameters
xx coord to new data point
yy coord to new data point
xErrorDeltax data point uncertainty
yErrorDeltay data point uncertainty

Use this method with error bar style XY.

Definition at line 388 of file gnuplot.cc.

References data, ns3::GnuplotDataset::m_data, NS_ASSERT, sample-rng-plot::x, and XY.

◆ AddEmptyLine()

void ns3::Gnuplot2dDataset::AddEmptyLine ( )

Add an empty line in the data output sequence.

Empty lines in the plot data break continuous lines and do other things in the output.

Definition at line 402 of file gnuplot.cc.

References data, and ns3::GnuplotDataset::m_data.

◆ SetDefaultErrorBars()

void ns3::Gnuplot2dDataset::SetDefaultErrorBars ( enum ErrorBars  errorBars)
static

Change default errorbars style for all newly created objects.

Parameters
errorBarsthe style of errorbars to use for newly created datasets.

Definition at line 348 of file gnuplot.cc.

References m_defaultErrorBars.

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

◆ SetDefaultStyle()

void ns3::Gnuplot2dDataset::SetDefaultStyle ( enum Style  style)
static

Change default style for all newly created objects.

Parameters
stylethe style of plotting to use for newly created datasets.

Definition at line 337 of file gnuplot.cc.

References m_defaultStyle.

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

◆ SetErrorBars()

void ns3::Gnuplot2dDataset::SetErrorBars ( enum ErrorBars  errorBars)
Parameters
errorBarsthe style of errorbars to display.

If you use any style other than none, you need to make sure you store the delta information in this dataset with the right GnuplotDataset::Add method.

Definition at line 353 of file gnuplot.cc.

References ns3::GnuplotDataset::m_data.

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

◆ SetStyle()

void ns3::Gnuplot2dDataset::SetStyle ( enum Style  style)

Member Data Documentation

◆ m_defaultErrorBars

enum ErrorBars ns3::Gnuplot2dDataset::m_defaultErrorBars
staticprivate

default error bars type

Definition at line 229 of file gnuplot.h.

Referenced by SetDefaultErrorBars().

◆ m_defaultStyle

enum Style ns3::Gnuplot2dDataset::m_defaultStyle
staticprivate

default plot style

Definition at line 228 of file gnuplot.h.

Referenced by SetDefaultStyle().


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