MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / set_variables_string

Method set_variables_string

source/matplot/axes_objects/labels.cpp:21–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 sizes_(sizes) {}
20
21 std::string labels::set_variables_string() {
22 std::string res;
23 if (rectangles_) {
24 auto word_size = [this](size_t word_index) {
25 if (sizes_.size() > word_index) {
26 return round(sizes_[word_index]);
27 } else {
28 return static_cast<double>(round(parent_->font_size()));
29 }
30 };
31 for (size_t i = 0; i < labels_.size(); ++i) {
32 double s = word_size(i);
33 res += " set object " + num2str(1000 + i) +
34 " rectangle at " + num2str(x_[i]) + ", " +
35 num2str(y_[i]) + " size " +
36 num2str(s * labels_[i].size() * width_factor) + ", " +
37 num2str(s * height_factor) + " fc lt 2 \n";
38 }
39 }
40 return res;
41 }
42
43 std::string labels::plot_string() {
44 std::string res = " '-' with labels";

Callers

nothing calls this directly

Calls 3

num2strFunction · 0.85
sizeMethod · 0.45
font_sizeMethod · 0.45

Tested by

no test coverage detected