Struct implot::Plot[][src]

pub struct Plot { /* fields omitted */ }

Struct to represent an ImPlot. This is the main construct used to contain all kinds of plots in ImPlot.

Plot is to be used (within an imgui window) with the following pattern:

let plotting_context = implot::Context::create();
let plot_ui = plotting_context.get_plot_ui();
implot::Plot::new("my title")
    .size(300.0, 200.0) // other things such as .x_label("some_label") can be added too
    .build(&plot_ui, || {
        // Do things such as plotting lines
    });

(If you are coming from the C++ implementation or the C bindings: build() calls both begin() and end() internally)

Implementations

impl Plot[src]

pub fn new(title: &str) -> Self[src]

Create a new plot with some defaults set. Does not draw anything yet. Note that this uses antialiasing by default, unlike the C++ API. If you are seeing artifacts or weird rendering, try disabling it.

pub fn size(mut self: Self, size_x: f32, size_y: f32) -> Self[src]

Sets the plot size, given as [size_x, size_y]. Units are the same as what imgui uses. TODO(4b4) ... which is? I'm not sure it's pixels

pub fn x_label(mut self: Self, label: &str) -> Self[src]

Set the x label of the plot

pub fn y_label(mut self: Self, label: &str) -> Self[src]

Set the y label of the plot

pub fn x_limits(
    mut self: Self,
    limits: &ImPlotRange,
    condition: Condition
) -> Self
[src]

Set the x limits of the plot

pub fn y_limits(
    mut self: Self,
    limits: &ImPlotRange,
    y_axis_choice: YAxisChoice,
    condition: Condition
) -> Self
[src]

Set the Y limits of the plot for the given Y axis. Call multiple times to set for multiple axes.

pub fn x_ticks(mut self: Self, ticks: &[f64], show_default: bool) -> Self[src]

Set X ticks without labels for the plot. The vector contains one label each in the form of a tuple (label_position, label_string). The show_default setting determines whether the default ticks are also shown.

pub fn y_ticks(
    mut self: Self,
    y_axis_choice: YAxisChoice,
    ticks: &[f64],
    show_default: bool
) -> Self
[src]

Set X ticks without labels for the plot. The vector contains one label each in the form of a tuple (label_position, label_string). The show_default setting determines whether the default ticks are also shown.

pub fn x_ticks_with_labels(
    mut self: Self,
    tick_labels: &[(f64, String)],
    show_default: bool
) -> Self
[src]

Set X ticks with labels for the plot. The vector contains one position and label each in the form of a tuple (label_position, label_string). The show_default setting determines whether the default ticks are also shown.

pub fn y_ticks_with_labels(
    mut self: Self,
    y_axis_choice: YAxisChoice,
    tick_labels: &[(f64, String)],
    show_default: bool
) -> Self
[src]

Set Y ticks with labels for the plot. The vector contains one position and label each in the form of a tuple (label_position, label_string). The show_default setting determines whether the default ticks are also shown.

pub fn with_plot_flags(mut self: Self, flags: &PlotFlags) -> Self[src]

Set the plot flags, see the help for PlotFlags for what the available flags are

pub fn with_x_axis_flags(mut self: Self, flags: &AxisFlags) -> Self[src]

Set the axis flags for the X axis in this plot

pub fn with_y_axis_flags(
    mut self: Self,
    y_axis_choice: YAxisChoice,
    flags: &AxisFlags
) -> Self
[src]

Set the axis flags for the selected Y axis in this plot

pub fn with_legend_location(
    mut self: Self,
    location: &PlotLocation,
    orientation: &PlotOrientation,
    outside: bool
) -> Self
[src]

Set the legend location, orientation and whether it is to be drawn outside the plot

pub fn begin(&self, plot_ui: &PlotUi<'_>) -> Option<PlotToken>[src]

Attempt to show the plot. If this returns a token, the plot will actually be drawn. In this case, use the drawing functionality to draw things on the plot, and then call end() on the token when done with the plot. If none was returned, that means the plot is not rendered.

For a convenient implementation of all this, use build() instead.

pub fn build<F: FnOnce()>(self, plot_ui: &PlotUi<'_>, f: F)[src]

Creates a window and runs a closure to construct the contents. This internally calls begin and end.

Note: the closure is not called if ImPlot::BeginPlot() returned false - TODO(4bb4) figure out if this is if things are not rendered

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.