pub struct Plot {
Show 23 fields pub plot_coord_mouse_pos: Vec2, pub canvas_position: Vec2, pub tick_period: Vec2, pub outer_border: Vec2, pub canvas_size: Vec2, pub background_color1: Color, pub background_color2: Color, pub show_grid: bool, pub zero_world: Vec2, pub time: f32, pub zoom: f32, pub hide_contour: bool, pub hide_tick_labels: bool, pub hide_half_ticks: bool, pub tick_label_color: Color, pub significant_digits: usize, pub show_target: bool, pub target_label_color: Color, pub target_color: Color, pub target_significant_digits: usize, pub show_axes: bool, pub bezier_num_points: usize, pub data: PlotData, /* private fields */
}
Expand description

Contains all relevant information to both the look of the canvas and the data to be plotted.

Fields

plot_coord_mouse_pos: Vec2

mouse position in the reference frame of the graph, corresponding to its axes

canvas_position: Vec2

Position of the canvas in World coordinates

tick_period: Vec2

Distance between consecutive grid lines

outer_border: Vec2

Size of the margins with respect to the canvas_size. The default is set to Vec2::new(0.03 * size.y / size.x, 0.03)

canvas_size: Vec2

Size of the graph in pixels

background_color1: Color

Color of even tiles

background_color2: Color

Color of odd tiles

show_grid: bool

The grid is shown by default

zero_world: Vec2

Position of the origin of the graph in World coordinates

time: f32

unused

zoom: f32

The current zoom value: adjustable with the MouseWheel

hide_contour: bool

Hides the black contour around the canvas

hide_tick_labels: bool

Hides numeric labels by the side of the grid lines

hide_half_ticks: bool

Hides half the numeric tick labels for a less crowded feel

tick_label_color: Color

Color for the numerical labels shown by the side of the grid lines

significant_digits: usize

Adjusts the number of significant digits for the tick labels

show_target: bool

A target can be spawned together with a pair of coordinates by pressing MouseButton::Middle

target_label_color: Color

The color for the coordinate pair by the side of the target

target_color: Color

Color of the target

target_significant_digits: usize

Number of significant digits for the target coordinates

show_axes: bool

Axes are shown by default

bezier_num_points: usize

The number of samples taken on the explicit function provided to Plot::plot_func or [Plot::plotopt_func`] functions

data: PlotData

Contains the data and metaparameters needed for drawing each kind of plot

Implementations

Customizable plotting function. Takes any type that implements Plotable, namely Vec<Vec2>, Vec<(f64, f64)>, Vec<f32>, …

Quickly plot data points using segments to connect consecutive points. Takes any type that implements Plotable, namely Vec<Vec2>, Vec<(f64, f64)>, Vec<f32>, …

Quickly plot data points using markers (scatter plot).

Quickly plot a function by providing said function. Defaults to a range on the both axes from -0.2 to 1.2.

Plot a function by providing said function and options.

Override the default plot bounds: x axis goes from bounds.lo.x to bounds.up.x. Beware! The tick period is automatically adjusted. Changing the tick period before setting the bounds will not have the intended effect. The bounds must be set before the ticks.

Panics

Panics if lo.x >= up.x or lo.y >= up.y.

Convert a point in plot coordinates to a point in world coordinates modulo the canvas position

Convert a point in world coordinates to a point in the graph coordinates.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. 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

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Creates Self using data from the given [World]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more