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

Method show_basic_plot

implot-examples/examples-shared/src/line_plots.rs:29–44  ·  view source on GitHub ↗
(ui: &Ui, plot_ui: &PlotUi)

Source from the content-addressed store, hash-verified

27 }
28
29 pub fn show_basic_plot(ui: &Ui, plot_ui: &PlotUi) {
30 ui.text(im_str!(
31 "This header just plots a line with as little code as possible."
32 ));
33 let content_width = ui.window_content_region_width();
34 Plot::new("Simple line plot")
35 // The size call could also be omitted, though the defaults don't consider window
36 // width, which is why we're not doing so here.
37 .size([content_width, 300.0])
38 .build(plot_ui, || {
39 // If this is called outside a plot build callback, the program will panic.
40 let x_positions = vec![0.1, 0.9];
41 let y_positions = vec![0.1, 0.9];
42 PlotLine::new("legend label").plot(&x_positions, &y_positions);
43 });
44 }
45
46 pub fn show_two_yaxis_plot(ui: &Ui, plot_ui: &PlotUi) {
47 ui.text(im_str!(

Callers

nothing calls this directly

Calls 3

buildMethod · 0.80
sizeMethod · 0.80
plotMethod · 0.80

Tested by

no test coverage detected