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

Method plot_string

source/matplot/axes_objects/line.cpp:90–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88 }
89
90 std::string line::plot_string() {
91 maybe_update_line_spec();
92 std::string res;
93 bool first = true;
94 for (const auto &style : styles_to_plot()) {
95 if (!first) {
96 res += ",";
97 }
98 const bool marker_size_is_variable = !marker_sizes_.empty();
99 const bool we_are_plotting_marker =
100 style != line_spec::style_to_plot::plot_line_only;
101
102 std::string str;
103 if (impulse_ && style == line_spec::style_to_plot::plot_line_only) {
104 str =
105 " '-' with impulse " + line_spec_.plot_string(style, false);
106 } else if (fill_ &&
107 style == line_spec::style_to_plot::plot_line_only) {
108 str = " '-' with filledcurves " +
109 line_spec_.plot_string(style, false);
110 } else {
111 str = " '-' " + line_spec_.plot_string(style, true);
112 }
113 if (marker_size_is_variable && we_are_plotting_marker) {
114 str = std::regex_replace(str,
115 std::regex(" pointsize \\d*\\.?\\d* "),
116 " pointsize variable ");
117 }
118 const bool color_is_variable = !marker_colors_.empty();
119 if (color_is_variable && we_are_plotting_marker) {
120 str = std::regex_replace(str,
121 std::regex(" linecolor rgb +[^ ]+ "),
122 " linecolor palette ");
123 }
124 if (use_y2_) {
125 str += " axes x1y2";
126 }
127 res += str;
128 if (first) {
129 first = false;
130 }
131 }
132 return res;
133 }
134
135 std::string line::legend_string(std::string_view title) {
136 if (line_spec_.has_line() && line_spec_.has_non_custom_marker()) {

Callers 1

legend_stringMethod · 0.45

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected