add legend support to gnuplot output
This commit is contained in:
@@ -74,6 +74,13 @@ Gnuplot::~Gnuplot ()
|
||||
m_datasets.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
Gnuplot::SetLegend (std::string xLegend, std::string yLegend)
|
||||
{
|
||||
m_xLegend = xLegend;
|
||||
m_yLegend = yLegend;
|
||||
}
|
||||
|
||||
void
|
||||
Gnuplot::AddDataset (const GnuplotDataset &dataset)
|
||||
{
|
||||
@@ -85,6 +92,8 @@ Gnuplot::GenerateOutput (std::ostream &os)
|
||||
{
|
||||
os << "set terminal png" << std::endl;
|
||||
os << "set output '" << m_pngFilename << "'" << std::endl;
|
||||
os << "set xlabel '" << m_xLegend << "'" << std::endl;
|
||||
os << "set ylabel '" << m_yLegend << "'" << std::endl;
|
||||
os << "plot ";
|
||||
for (Datasets::const_iterator i = m_datasets.begin (); i != m_datasets.end ();)
|
||||
{
|
||||
|
||||
@@ -73,12 +73,16 @@ public:
|
||||
Gnuplot (std::string pngFilename);
|
||||
~Gnuplot ();
|
||||
|
||||
void SetLegend (std::string xLegend, std::string yLegend);
|
||||
|
||||
void AddDataset (const GnuplotDataset &dataset);
|
||||
|
||||
void GenerateOutput (std::ostream &os);
|
||||
private:
|
||||
typedef std::vector<GnuplotDataset *> Datasets;
|
||||
Datasets m_datasets;
|
||||
std::string m_xLegend;
|
||||
std::string m_yLegend;
|
||||
std::string m_pngFilename;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user