diff --git a/lib/Plot.cpp b/lib/Plot.cpp index 22d156d..9265dc2 100644 --- a/lib/Plot.cpp +++ b/lib/Plot.cpp @@ -111,6 +111,12 @@ PlotData::PlotData(const XYStatData &data, const Index i, const Index j) setCommand("'" + tmpFileName + "' " + usingCmd); } +// PlotHLine constructor /////////////////////////////////////////////////////// +PlotHLine::PlotHLine(const double y) +{ + setCommand(strFrom(y)); +} + // PlotFunction constructor //////////////////////////////////////////////////// PlotFunction::PlotFunction(const DoubleFunction &function, const double xMin, const double xMax, const unsigned int nPoint) @@ -173,6 +179,18 @@ void Caption::operator()(PlotOptions &option) const option.caption = caption_; } +// Label constructor /////////////////////////////////////////////////////////// +Label::Label(const string &label, const Axis axis) +: label_(label) +, axis_(axis) +{} + +// Label modifier ////////////////////////////////////////////////////////////// +void Label::operator()(PlotOptions &option) const +{ + option.label[static_cast(axis_)] = label_; +} + // Color constructor /////////////////////////////////////////////////////////// Color::Color(const string &color) : color_(color) diff --git a/lib/Plot.hpp b/lib/Plot.hpp index 743ec59..892e74e 100644 --- a/lib/Plot.hpp +++ b/lib/Plot.hpp @@ -81,6 +81,15 @@ public: virtual ~PlotData(void) = default; }; +class PlotHLine: public PlotObject +{ +public: + // constructor + PlotHLine(const double y); + // destructor + virtual ~PlotHLine(void) = default; +}; + class PlotFunction: public PlotObject { public: @@ -146,6 +155,20 @@ private: const std::string caption_; }; +class Label: public PlotModifier +{ +public: + // constructor + explicit Label(const std::string &label, const Axis axis); + // destructor + virtual ~Label(void) = default; + // modifier + virtual void operator()(PlotOptions &option) const; +private: + const std::string label_; + const Axis axis_; +}; + class Color: public PlotModifier { public: