MCPcopy Create free account
hub / github.com/4bb4/implot-rs / plot

Method plot

src/plot_elements.rs:28–43  ·  view source on GitHub ↗

Plot a line. Use this in closures passed to [`Plot::build()`](struct.Plot.html#method.build)

(&self, x: &[f64], y: &[f64])

Source from the content-addressed store, hash-verified

26
27 /// Plot a line. Use this in closures passed to [`Plot::build()`](struct.Plot.html#method.build)
28 pub fn plot(&self, x: &[f64], y: &[f64]) {
29 // If there is no data to plot, we stop here
30 if x.len().min(y.len()) == 0 {
31 return;
32 }
33 unsafe {
34 sys::ImPlot_PlotLinedoublePtrdoublePtr(
35 im_str!("{}", self.label).as_ptr() as *const c_char,
36 x.as_ptr(),
37 y.as_ptr(),
38 x.len().min(y.len()) as i32, // "as" casts saturate as of Rust 1.45. This is safe here.
39 0, // No offset
40 std::mem::size_of::<f64>() as i32, // Stride, set to one f64 for the standard use case
41 );
42 }
43 }
44}
45
46/// Struct to provide functionality for plotting a line in a plot with stairs style.

Callers 15

show_basic_plotFunction · 0.80
show_basic_plotFunction · 0.80
show_custom_markers_plotFunction · 0.80
show_basic_heatmapFunction · 0.80
show_basic_plotFunction · 0.80
show_basic_vertical_plotFunction · 0.80
show_basic_plotFunction · 0.80
show_basic_plotMethod · 0.80
show_two_yaxis_plotMethod · 0.80
show_axis_equal_plotMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected