Struct egui::widgets::plot::Plot[][src]

pub struct Plot { /* fields omitted */ }
Expand description

A 2D plot, e.g. a graph of a function.

Plot supports multiple lines and points.

use egui::plot::{Line, Plot, Value, Values};
let sin = (0..1000).map(|i| {
    let x = i as f64 * 0.01;
    Value::new(x, x.sin())
});
let line = Line::new(Values::from_values_iter(sin));
ui.add(
    Plot::new("my_plot").line(line).view_aspect(2.0)
);

Implementations

Give a unique id for each plot within the same Ui.

Add a data lines.

Add a polygon. The polygon has to be convex.

Add a text.

Add data points.

Add arrows.

Add an image.

Add a horizontal line. Can be useful e.g. to show min/max bounds or similar. Always fills the full width of the plot.

Add a vertical line. Can be useful e.g. to show min/max bounds or similar. Always fills the full height of the plot.

width / height ratio of the data. For instance, it can be useful to set this to 1.0 for when the two axes show the same unit. By default the plot window’s aspect ratio is used.

width / height ratio of the plot region. By default no fixed aspect ratio is set (and width/height will fill the ui it is in).

Width of plot. By default a plot will fill the ui it is in. If you set Self::view_aspect, the width can be calculated from the height.

Height of plot. By default a plot will fill the ui it is in. If you set Self::view_aspect, the height can be calculated from the width.

Minimum size of the plot view.

Show the x-value (e.g. when hovering). Default: true.

Show the y-value (e.g. when hovering). Default: true.

Always keep the x-axis centered. Default: false.

Always keep the y-axis centered. Default: false.

Whether to allow zooming in the plot. Default: true.

Whether to allow dragging in the plot to move the bounds. Default: true.

Expand bounds to include the given x value. For instance, to always show the y axis, call plot.include_x(0.0).

Expand bounds to include the given y value. For instance, to always show the x axis, call plot.include_y(0.0).

Show a legend including all named items.

Whether or not to show the background Rect. Can be useful to disable if the plot is overlaid over existing content. Default: true.

Show the axes. Can be useful to disable if the plot is overlaid over an existing grid or content. Default: [true; 2].

Trait Implementations

Allocate space, interact, paint, and return a Response. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.