您的位置:首页 > 编程语言 > Go语言

Try Pangolin (5) - SimplePlot

2016-07-08 01:45 507 查看
Structure DataLog is defined in plotter.h:

// Data logger object
pangolin::DataLog <span style="color:#3366FF;">log</span>;




To name labels:
// Optionally add named labels
std::vector<std::string> labels;
labels.push_back(std::string("sin(t)"));
labels.push_back(std::string("cos(t)"));
labels.push_back(std::string("sin(t)+cos(t)"));
<span style="color:#3366FF;">log</span>.<span style="color:#CC0000;">SetLabels</span>(labels);


About pangolin::Plotter:

// OpenGL 'view' of data. We might have many views of the same data.
<span style="color:#3333FF;">pangolin::Plotter</span> plotter(&log,0,4*M_PI/tinc,-2,2,M_PI/(4*tinc),0.5);
plotter.SetBounds(0.0, 1.0, 0.0, 1.0);
plotter.<span style="color:#FF0000;">Track</span>("$i");




And nothing changed after commenting out log.Track("$i");

Let's compare the result and the values:

Result:



As shown in this plot:

The "top", "bottom", "left" and "right" are in accordance with the given values.

"tickx" and "ticky" are the smallest units of x and y axis.

Compare the difference between Display and DisplayBase:



pangolin::<span style="color:#009900;">DisplayBase</span>()
.AddDisplay(plotter);


pangolin::Plotter plotter(&log,0,4*M_PI/tinc,-2,2,M_PI/(4*tinc),0.5) is the base of the whole display,

while:

pangolin::DataLog log;
...
log<strong><span style="color:#CC0000;">.Log</span></strong>(sin(t),cos(t),sin(t)+cos(t));
t += tinc;
    (.Log) defines the curve.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: