Struct egui::widgets::plot::Plot [−][src]
A 2D plot, e.g. a graph of a function.
Plot
supports multiple curves.
use egui::plot::{Curve, Plot, Value}; let sin = (0..1000).map(|i| { let x = i as f64 * 0.01; Value::new(x, x.sin()) }); let curve = Curve::from_values_iter(sin); ui.add( Plot::default().curve(curve).view_aspect(2.0) );
Implementations
impl Plot
[src]
pub fn curve(self, curve: Curve) -> Self
[src]
Add a data curve. You can add multiple curves.
pub fn hline(self, hline: HLine) -> Self
[src]
Add a horizontal line. Can be useful e.g. to show min/max bounds or similar. Always fills the full width of the plot.
pub fn vline(self, vline: VLine) -> Self
[src]
Add a vertical line. Can be useful e.g. to show min/max bounds or similar. Always fills the full height of the plot.
pub fn include_x(self, x: impl Into<f64>) -> Self
[src]
Expand bounds to include the given x value.
pub fn include_y(self, y: impl Into<f64>) -> Self
[src]
Expand bounds to include the given y value.
For instance, to always show the x axis, call plot.include_y(0.0)
.
pub fn symmetrical_x_bounds(self, symmetrical_x_bounds: bool) -> Self
[src]
If true, the x-bounds will be symmetrical, so that the x=0 zero line is always in the center.
pub fn symmetrical_y_bounds(self, symmetrical_y_bounds: bool) -> Self
[src]
If true, the y-bounds will be symmetrical, so that the y=0 zero line is always in the center.
pub fn data_aspect(self, data_aspect: f32) -> Self
[src]
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.
pub fn view_aspect(self, view_aspect: f32) -> Self
[src]
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).
pub fn width(self, width: f32) -> Self
[src]
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.
pub fn height(self, height: f32) -> Self
[src]
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.
pub fn min_size(self, min_size: Vec2) -> Self
[src]
Minimum size of the plot view.
pub fn show_x(self, show_x: bool) -> Self
[src]
Show the x-value (e.g. when hovering). Default: true
.
pub fn show_y(self, show_y: bool) -> Self
[src]
Show the y-value (e.g. when hovering). Default: true
.
Trait Implementations
impl Clone for Plot
[src]
impl Default for Plot
[src]
impl PartialEq<Plot> for Plot
[src]
impl StructuralPartialEq for Plot
[src]
impl Widget for Plot
[src]
Auto Trait Implementations
impl RefUnwindSafe for Plot
impl Send for Plot
impl Sync for Plot
impl Unpin for Plot
impl UnwindSafe for Plot
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,