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

Function show_basic_plot

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

Source from the content-addressed store, hash-verified

5use implot::{Plot, PlotStairs, PlotUi};
6
7pub fn show_basic_plot(ui: &Ui, plot_ui: &PlotUi) {
8 ui.text_wrapped(im_str!(
9 "This header just plots a stairs-style line with as little code as possible."
10 ));
11 let content_width = ui.window_content_region_width();
12 Plot::new("Simple stairs plot")
13 // The size call could also be omitted, though the defaults don't consider window
14 // width, which is why we're not doing so here.
15 .size([content_width, 300.0])
16 .build(plot_ui, || {
17 // If this is called outside a plot build callback, the program will panic.
18 let x_positions = vec![0.1, 0.2, 0.5];
19 let y_positions = vec![0.1, 0.3, 0.9];
20 PlotStairs::new("legend label").plot(&x_positions, &y_positions);
21 });
22}
23
24pub fn show_demo_headers(ui: &Ui, plot_ui: &PlotUi) {
25 if CollapsingHeader::new(im_str!("Stairs plot: Basic")).build(&ui) {

Callers 1

show_demo_headersFunction · 0.70

Calls 3

buildMethod · 0.80
sizeMethod · 0.80
plotMethod · 0.80

Tested by

no test coverage detected