Robowflex  v0.1
Making MoveIt Easy
robowflex::IO::GNUPlotPlanDataSetOutputter Class Reference

Helper class to plot a real metric as a box plot using GNUPlot from benchmarking data. More...

#include <gnuplot.h>

+ Inheritance diagram for robowflex::IO::GNUPlotPlanDataSetOutputter:

Public Member Functions

 GNUPlotPlanDataSetOutputter (const std::string &metric)
 Constructor. More...
 
 ~GNUPlotPlanDataSetOutputter () override
 Destructor. More...
 
void dump (const PlanDataSet &results) override
 Visualize results. More...
 
- Public Member Functions inherited from robowflex::PlanDataSetOutputter
virtual ~PlanDataSetOutputter ()=default
 Virtual destructor for cleaning up resources. More...
 

Private Attributes

const std::string metric_
 
GNUPlotHelper helper_
 

Detailed Description

Helper class to plot a real metric as a box plot using GNUPlot from benchmarking data.

Definition at line 128 of file gnuplot.h.

Constructor & Destructor Documentation

◆ GNUPlotPlanDataSetOutputter()

GNUPlotPlanDataSetOutputter::GNUPlotPlanDataSetOutputter ( const std::string metric)

Constructor.

Definition at line 173 of file gnuplot.cpp.

173  : metric_(metric)
174 {
175 }

◆ ~GNUPlotPlanDataSetOutputter()

GNUPlotPlanDataSetOutputter::~GNUPlotPlanDataSetOutputter ( )
override

Destructor.

Definition at line 177 of file gnuplot.cpp.

178 {
179 }

Member Function Documentation

◆ dump()

void GNUPlotPlanDataSetOutputter::dump ( const PlanDataSet results)
overridevirtual

Visualize results.

Parameters
[in]resultsResults to visualize.

Implements robowflex::PlanDataSetOutputter.

Definition at line 181 of file gnuplot.cpp.

182 {
184  bpo.instance = results.name;
185  bpo.title = log::format("\\\"%1%\\\" for Experiment \\\"%2%\\\"", metric_, results.name);
186  bpo.y.label = metric_;
187  bpo.y.min = 0.;
188 
189  for (const auto &query : results.data)
190  {
191  const auto &name = query.first;
192  const auto &points = query.second;
193 
194  std::vector<double> values;
195  for (const auto &run : points)
196  {
197  if (metric_ == "time")
198  values.emplace_back(run->time);
199  else
200  values.emplace_back(boost::get<double>(run->metrics[metric_]));
201  }
202 
203  bpo.values.emplace(name, values);
204  }
205 
206  helper_.boxplot(bpo);
207 }
void boxplot(const BoxPlotOptions &options)
Plot box data.
Definition: gnuplot.cpp:112
T emplace_back(T... args)
std::string format(const std::string &fmt, Args &&... args)
Recursion base case, return string form of formatted arguments.
Definition: log.h:60
std::map< std::string, Values > values
Map of names to data.
Definition: gnuplot.h:76
double min
Lower axis limit. If NaN, will auto-adjust.
Definition: gnuplot.h:44
std::string title
Title of the plot.
Definition: gnuplot.h:47

Member Data Documentation

◆ helper_

GNUPlotHelper robowflex::IO::GNUPlotPlanDataSetOutputter::helper_
private

Definition at line 146 of file gnuplot.h.

◆ metric_

const std::string robowflex::IO::GNUPlotPlanDataSetOutputter::metric_
private

Definition at line 145 of file gnuplot.h.


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