| 17 | : axes_object(parent), y_data_(y_data), x_data_(groups) {} |
| 18 | |
| 19 | std::string box_chart::plot_string() { |
| 20 | maybe_update_face_color(); |
| 21 | std::vector<double> unique_groups = unique(x_data_); |
| 22 | if (unique_groups.empty()) { |
| 23 | unique_groups.emplace_back(1.); |
| 24 | } |
| 25 | std::string res; |
| 26 | // one plot for each category |
| 27 | for (size_t i = 0; i < unique_groups.size(); ++i) { |
| 28 | if (i != 0) { |
| 29 | res += ", "; |
| 30 | } |
| 31 | if (box_style_ == box_chart::box_style_option::filled) { |
| 32 | res += " '-' with boxplot fillstyle solid border rgb '" + |
| 33 | to_string(edge_color_) + "' fillcolor '" + |
| 34 | to_string(face_color_) + " linewidth " + |
| 35 | num2str(edge_width_) + "' pointsize " + |
| 36 | num2str(whisker_size_); |
| 37 | } else { |
| 38 | res += " '-' with boxplot fillstyle solid 0.0 border rgb '" + |
| 39 | to_string(edge_color_) + "' fillcolor '" + |
| 40 | to_string(face_color_) + " linewidth " + |
| 41 | num2str(edge_width_) + "' pointsize " + |
| 42 | num2str(whisker_size_); |
| 43 | } |
| 44 | switch (whisker_style_) { |
| 45 | case line_spec::marker_style::plus_sign: |
| 46 | res += " pointtype 1"; |
| 47 | break; |
| 48 | case line_spec::marker_style::circle: |
| 49 | res += (!whisker_face_ ? " pointtype 6" : " pointtype 7"); |
| 50 | break; |
| 51 | case line_spec::marker_style::asterisk: |
| 52 | res += " pointtype 3"; |
| 53 | break; |
| 54 | case line_spec::marker_style::point: |
| 55 | res += " pointtype 7"; |
| 56 | break; |
| 57 | case line_spec::marker_style::cross: |
| 58 | res += " pointtype 2"; |
| 59 | break; |
| 60 | case line_spec::marker_style::square: |
| 61 | res += (!whisker_face_ ? " pointtype 4" : " pointtype 5"); |
| 62 | break; |
| 63 | case line_spec::marker_style::diamond: |
| 64 | res += (!whisker_face_ ? " pointtype 12" : " pointtype 13"); |
| 65 | break; |
| 66 | case line_spec::marker_style::upward_pointing_triangle: |
| 67 | res += (!whisker_face_ ? " pointtype 8" : " pointtype 9"); |
| 68 | break; |
| 69 | case line_spec::marker_style::downward_pointing_triangle: |
| 70 | res += (!whisker_face_ ? " pointtype 10" : " pointtype 11"); |
| 71 | break; |
| 72 | case line_spec::marker_style::pentagram: |
| 73 | res += (!whisker_face_ ? " pointtype 14" : " pointtype 15"); |
| 74 | break; |
| 75 | default: |
| 76 | // if none or custom, we have to plot the markers as labels |