forked from Cryoris/matplotlib-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlegend.cpp
More file actions
44 lines (39 loc) · 982 Bytes
/
legend.cpp
File metadata and controls
44 lines (39 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <vector>
#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
void basic() {
plt::figure();
plt::plot({1, 2, 3}, {{"label", "a line"}});
plt::plot({1, 3, 5}, {{"label", "also a line"}});
plt::legend();
plt::show();
}
void loc() {
plt::figure();
plt::plot({1, 2, 3}, {{"label", "a line"}});
plt::plot({1, 3, 5}, {{"label", "also a line"}});
plt::legend("lower left");
plt::show();
}
void bbox() {
plt::figure();
plt::plot({1, 2, 3}, {{"label", "a line"}});
plt::plot({1, 3, 5}, {{"label", "also a line"}});
plt::legend(std::vector<double>{0.5, 0.7});
plt::show();
}
// currently not working: only strings can be provided in the keyword arguments
// void keywords() {
// plt::figure();
// plt::plot({1, 2, 3}, {{"label", "a line"}});
// plt::plot({1, 3, 5}, {{"label", "also a line"}});
// plt::legend("best", {{"borderpad", "0.2"}});
// plt::show();
// }
int main() {
basic();
loc();
bbox();
// keywords();
return 0;
}