(strategy: PlotRenderStrategy)
| 68 | } |
| 69 | |
| 70 | fn marker_plot(strategy: PlotRenderStrategy) -> PlotWidget { |
| 71 | let markers = [ |
| 72 | ( |
| 73 | "circle", |
| 74 | MarkerStyle::circle(MARKER_SIZE), |
| 75 | Color::from_rgb(0.25, 0.50, 0.95), |
| 76 | ), |
| 77 | ( |
| 78 | "ring", |
| 79 | MarkerStyle::ring(MARKER_SIZE), |
| 80 | Color::from_rgb(0.10, 0.70, 0.45), |
| 81 | ), |
| 82 | ( |
| 83 | "square", |
| 84 | MarkerStyle::square(MARKER_SIZE), |
| 85 | Color::from_rgb(0.90, 0.55, 0.10), |
| 86 | ), |
| 87 | ( |
| 88 | "star", |
| 89 | MarkerStyle::star(MARKER_SIZE), |
| 90 | Color::from_rgb(0.95, 0.25, 0.15), |
| 91 | ), |
| 92 | ( |
| 93 | "triangle", |
| 94 | MarkerStyle::triangle(MARKER_SIZE), |
| 95 | Color::from_rgb(0.60, 0.35, 0.90), |
| 96 | ), |
| 97 | ]; |
| 98 | |
| 99 | let mut builder = PlotWidgetBuilder::new() |
| 100 | .with_render_strategy(strategy) |
| 101 | .with_x_label("x") |
| 102 | .with_y_label("y") |
| 103 | .with_x_lim(-1.0, 1.0) |
| 104 | .with_y_lim(-0.75, markers.len() as f64 - 0.25) |
| 105 | .disable_controls_help(); |
| 106 | |
| 107 | for (index, (label, style, color)) in markers.into_iter().enumerate() { |
| 108 | let y = markers.len() as f64 - 1.0 - index as f64; |
| 109 | let series = Series::markers_only(vec![[0.0, y]], style) |
| 110 | .with_label(label) |
| 111 | .with_color(color); |
| 112 | builder = builder.add_series(series); |
| 113 | } |
| 114 | |
| 115 | builder.build().unwrap() |
| 116 | } |
no test coverage detected