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

Method plot_string

source/matplot/axes_objects/parallel_lines.cpp:73–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 }
72
73 std::string parallel_lines::plot_string() {
74 maybe_update_line_spec();
75 /*
76 * The ideal would be to use "with parallel",
77 * but it just does not work from one version
78 * to the other. Every time gnuplot updates,
79 * our code with "with parallel" stopped working.
80 * Thus, we will need to create lines for each
81 * point as if this was a line plot. The commands
82 * for line plots should be more stable.
83 */
84
85 // The parallel lines representing points
86 const bool color_is_variable = !line_colors_.empty();
87 std::string res =
88 " '-' " + line_spec_.plot_string(
89 line_spec::style_to_plot::plot_line_only, true);
90 if (color_is_variable) {
91 res = std::regex_replace(res, std::regex(" linecolor rgb +[^ ]+ "),
92 " linecolor palette ");
93 }
94
95 // The fake axes with their fake ticks
96 res += ", '-' with lines linecolor 'black'";
97
98 // Labels for the fake ticks
99 // Have a look at:
100 // https://www.mathworks.com/help/matlab/ref/parallelplot.html
101 res += ", '-' with labels right";
102
103 // Labels for last dimension
104 res += ", '-' with labels left";
105
106 return res;
107 }
108
109 void parallel_lines::maybe_update_line_spec() {
110 // parallel coordinates work with lines only

Callers 1

legend_stringMethod · 0.45

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected