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

Method styles_to_plot

source/matplot/axes_objects/line.cpp:30–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28 x_data_(x_data), z_data_(z_data) {}
29
30 std::vector<line_spec::style_to_plot> line::styles_to_plot() {
31 std::vector<line_spec::style_to_plot> result;
32 // if it has a line...
33 if (line_spec_.has_line()) {
34 // ...and a marker
35 if (line_spec_.has_non_custom_marker()) {
36 if (line_spec_.line_and_marker_are_the_same_color()) {
37 if (marker_indices_.empty()) {
38 result.emplace_back(
39 line_spec::style_to_plot::plot_line_and_marker);
40 } else {
41 result.emplace_back(
42 line_spec::style_to_plot::plot_line_only);
43 result.emplace_back(
44 line_spec::style_to_plot::plot_marker_only);
45 }
46 } else {
47 result.emplace_back(
48 line_spec::style_to_plot::plot_line_only);
49 result.emplace_back(
50 line_spec::style_to_plot::plot_marker_only);
51 }
52 if (line_spec_.marker_face()) {
53 if (!line_spec_.marker_and_face_are_the_same_color()) {
54 result.emplace_back(
55 line_spec::style_to_plot::plot_marker_face_only);
56 }
57 }
58 } else {
59 // ...and no marker
60 result.emplace_back(line_spec::style_to_plot::plot_line_only);
61 }
62 } else {
63 // ...only a marker
64 if (line_spec_.has_non_custom_marker()) {
65 result.emplace_back(line_spec::style_to_plot::plot_marker_only);
66 if (line_spec_.marker_face() &&
67 !line_spec_.marker_and_face_are_the_same_color()) {
68 result.emplace_back(
69 line_spec::style_to_plot::plot_marker_face_only);
70 }
71 } else {
72 // has nothing, fallback to a solid line
73 result.emplace_back(line_spec::style_to_plot::plot_line_only);
74 }
75 }
76 // if we draw the line as impulse
77 if (impulse_ || fill_) {
78 // we cannot plot the line and marker together
79 auto it = std::find(result.begin(), result.end(),
80 line_spec::style_to_plot::plot_line_and_marker);
81 if (it != result.end()) {
82 result.erase(it);
83 result.emplace_back(line_spec::style_to_plot::plot_line_only);
84 result.emplace_back(line_spec::style_to_plot::plot_marker_only);
85 }
86 }
87 return result;

Callers

nothing calls this directly

Calls 8

has_lineMethod · 0.80
has_non_custom_markerMethod · 0.80
emptyMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
marker_faceMethod · 0.45

Tested by

no test coverage detected