24 #ifndef COM_DAFER45_TBTK_PLOT_PLOTTER
25 #define COM_DAFER45_TBTK_PLOT_PLOTTER
28 #include "TBTK/Plot/PlotCanvas.h"
29 #include "TBTK/Plot/Decoration.h"
30 #include "TBTK/Plot/Path.h"
31 #include "TBTK/Plot/Point.h"
41 #include <opencv2/core/core.hpp>
42 #include <opencv2/highgui/highgui.hpp>
56 void setWidth(
unsigned int width);
59 void setHeight(
unsigned int height);
70 void setBoundsX(
double minX,
double maxX);
73 void setBoundsY(
double minY,
double maxY);
76 void setBounds(
double minX,
double maxX,
double minY,
double maxY);
79 void setAutoScaleX(
bool autoScaleX);
82 void setAutoScaleY(
bool autoScaleY);
85 void setAutoScale(
bool autoScale);
88 void setLabelX(
const std::string &labelX);
91 void setLabelY(
const std::string &labelY);
94 void setCanvas(cv::Mat &canvas);
97 const cv::Mat& getCanvas();
103 const Decoration &decoration = Decoration(
104 {0, 0, 0}, Decoration::LineStyle::Point
110 const std::vector<double> &axis,
111 const std::vector<double> &data,
112 const Decoration &decoration = Decoration(
113 {0, 0, 0}, Decoration::LineStyle::Line
119 const std::vector<double> &data,
120 const Decoration &decoration = Decoration(
121 {0, 0, 0}, Decoration::LineStyle::Line
127 const Property::DOS &dos,
129 unsigned int windowSize = 51
133 void plot(
const Property::EigenValues &eigenValues);
137 const std::vector<std::vector<double>> &data
142 const Array<double> &data,
143 const Decoration &decoration = Decoration(
144 {0, 0, 0}, Decoration::LineStyle::Line
150 const std::vector<std::vector<double>> &data,
151 const std::vector<std::vector<double>> &intensity,
152 const Decoration &decoration = Decoration(
153 {0, 0, 0}, Decoration::LineStyle::Point
159 const Array<double> &data,
160 const Array<double> &intensity,
161 const Decoration &decoration = Decoration(
162 {0, 0, 0}, Decoration::LineStyle::Point
167 void setHold(
bool hold);
173 void save(std::string filename);
179 bool autoScaleX, autoScaleY;
186 std::vector<Drawable*> dataStorage;
189 void drawDataStorage();
192 void clearDataStorage();
195 inline void Plotter::setWidth(
unsigned int width){
196 canvas.setWidth(width);
199 inline void Plotter::setHeight(
unsigned int height){
200 canvas.setHeight(height);
203 inline void Plotter::setPadding(
206 double paddingBottom,
217 inline void Plotter::setBoundsX(
223 "Plotter::setBoundsX()",
224 "minX has to be smaller than maxX",
227 this->autoScaleX =
false;
228 canvas.setBoundsX(minX, maxX);
231 inline void Plotter::setBoundsY(
237 "Plotter::setBoundsY()",
238 "minY has to be smaller than maxY",
241 this->autoScaleY =
false;
242 canvas.setBoundsY(minY, maxY);
245 inline void Plotter::setBounds(
251 setBoundsX(minX, maxX);
252 setBoundsY(minY, maxY);
255 inline void Plotter::setAutoScaleX(
bool autoScaleX){
256 this->autoScaleX = autoScaleX;
259 inline void Plotter::setAutoScaleY(
bool autoScaleY){
260 this->autoScaleY = autoScaleY;
263 inline void Plotter::setAutoScale(
bool autoScale){
264 setAutoScaleX(autoScale);
265 setAutoScaleY(autoScale);
268 inline void Plotter::setLabelX(
const std::string &labelX){
269 canvas.setLabelX(labelX);
272 inline void Plotter::setLabelY(
const std::string &labelY){
273 canvas.setLabelY(labelY);
276 inline void Plotter::setCanvas(cv::Mat &canvas){
277 this->canvas.setCanvas(canvas);
280 inline const cv::Mat& Plotter::getCanvas(){
281 if(dataStorage.size() != 0){
286 return canvas.getCanvas();
289 inline void Plotter::setHold(
bool hold){
293 inline void Plotter::clear(){
298 inline void Plotter::save(std::string filename){
299 if(dataStorage.size() != 0){
304 canvas.save(filename);
307 inline void Plotter::clearDataStorage(){
308 for(
unsigned int n = 0; n < dataStorage.size(); n++)
309 delete dataStorage[n];