Struct implot::Plot[][src]

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

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

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.

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

Set the x label of the plot

Set the y label of the plot

Set the x limits of the plot.

Note: This conflicts with linked_x_limits, whichever is called last on plot construction takes effect.

Set linked x limits for this plot. Pass clones of the same Rc into other plots to link their limits with the same values.

Note: This conflicts with x_limits, whichever is called last on plot construction takes effect.

Set the Y limits of the plot for the given Y axis. Call multiple times with different y_axis_choice values to set for multiple axes, or use the convenience methods such as Plot::y1_limits.

Note: This conflicts with linked_y_limits, whichever is called last on plot construction takes effect for a given axis.

Convenience function to directly set the Y limits for the first Y axis. To programmatically (or on demand) decide which axis to set limits for, use Plot::y_limits

Convenience function to directly set the Y limits for the second Y axis. To programmatically (or on demand) decide which axis to set limits for, use Plot::y_limits

Convenience function to directly set the Y limits for the third Y axis. To programmatically (or on demand) decide which axis to set limits for, use Plot::y_limits

Set linked Y limits of the plot for the given Y axis. Pass clones of the same Rc into other plots to link their limits with the same values. Call multiple times with different y_axis_choice values to set for multiple axes, or use the convenience methods such as Plot::y1_limits.

Note: This conflicts with y_limits, whichever is called last on plot construction takes effect for a given axis.

Convenience function to directly set linked Y limits for the first Y axis. To programmatically (or on demand) decide which axis to set limits for, use Plot::linked_y_limits.

Convenience function to directly set linked Y limits for the second Y axis. To programmatically (or on demand) decide which axis to set limits for, use Plot::linked_y_limits.

Convenience function to directly set linked Y limits for the third Y axis. To programmatically (or on demand) decide which axis to set limits for, use Plot::linked_y_limits.

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.

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.

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.

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.

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

Set the axis flags for the X axis in this plot

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

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

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.

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

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.