pub struct Plotter { /* private fields */ }
Implementations§
Source§impl Plotter
impl Plotter
Sourcepub fn new() -> Plotter
pub fn new() -> Plotter
new
creates a new Plotter
object to manage asynchronous plots
Examples found in repository?
examples/simplexy.rs (line 21)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let x = linspace(0, 10, 100);
let y_sin = x.iter().map(|x| x.sin()).collect();
let xy_sin = zip2(&x, &y_sin);
let xy_lin = zip2(&x, &x);
// Creates a new plot builder
let mut pb = PlotBuilder2D::new();
// Adds the sin plot and the cos plot
pb.add_simple_xy(xy_sin);
pb.add_simple_xy(xy_lin);
let mut plt = Plotter::new();
plt.plot2d(pb);
plt.join();
}
More examples
examples/coloredxy.rs (line 21)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let x = linspace(0, 10, 100);
let y_sin = x.iter().map(|x| x.sin()).collect();
let xy_sin = zip2(&x, &y_sin);
let xy_lin = zip2(&x, &x);
// Creates a new plot builder
let mut pb = PlotBuilder2D::new();
// Adds the sin plot and the linear plot with custom colors
pb.add_color_xy(xy_sin, [1.0, 0.0, 0.0, 1.0]);
pb.add_color_xy(xy_lin, [0.0, 0.0, 1.0, 1.0]);
let mut plt = Plotter::new();
plt.plot2d(pb);
plt.join();
}
Sourcepub fn plot2d(&mut self, plotbuilder: PlotBuilder2D)
pub fn plot2d(&mut self, plotbuilder: PlotBuilder2D)
plot2d
is currently the only supported plotting function. It takes a PlotBuilder2D
containing all needed information.
Examples found in repository?
examples/simplexy.rs (line 22)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let x = linspace(0, 10, 100);
let y_sin = x.iter().map(|x| x.sin()).collect();
let xy_sin = zip2(&x, &y_sin);
let xy_lin = zip2(&x, &x);
// Creates a new plot builder
let mut pb = PlotBuilder2D::new();
// Adds the sin plot and the cos plot
pb.add_simple_xy(xy_sin);
pb.add_simple_xy(xy_lin);
let mut plt = Plotter::new();
plt.plot2d(pb);
plt.join();
}
More examples
examples/coloredxy.rs (line 22)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let x = linspace(0, 10, 100);
let y_sin = x.iter().map(|x| x.sin()).collect();
let xy_sin = zip2(&x, &y_sin);
let xy_lin = zip2(&x, &x);
// Creates a new plot builder
let mut pb = PlotBuilder2D::new();
// Adds the sin plot and the linear plot with custom colors
pb.add_color_xy(xy_sin, [1.0, 0.0, 0.0, 1.0]);
pb.add_color_xy(xy_lin, [0.0, 0.0, 1.0, 1.0]);
let mut plt = Plotter::new();
plt.plot2d(pb);
plt.join();
}
Sourcepub fn join(self)
pub fn join(self)
The join
function allows the thread that owns the Plotter
to wait until the user has closed all open plot windows before continuing.
Examples found in repository?
examples/simplexy.rs (line 23)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let x = linspace(0, 10, 100);
let y_sin = x.iter().map(|x| x.sin()).collect();
let xy_sin = zip2(&x, &y_sin);
let xy_lin = zip2(&x, &x);
// Creates a new plot builder
let mut pb = PlotBuilder2D::new();
// Adds the sin plot and the cos plot
pb.add_simple_xy(xy_sin);
pb.add_simple_xy(xy_lin);
let mut plt = Plotter::new();
plt.plot2d(pb);
plt.join();
}
More examples
examples/coloredxy.rs (line 23)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let x = linspace(0, 10, 100);
let y_sin = x.iter().map(|x| x.sin()).collect();
let xy_sin = zip2(&x, &y_sin);
let xy_lin = zip2(&x, &x);
// Creates a new plot builder
let mut pb = PlotBuilder2D::new();
// Adds the sin plot and the linear plot with custom colors
pb.add_color_xy(xy_sin, [1.0, 0.0, 0.0, 1.0]);
pb.add_color_xy(xy_lin, [0.0, 0.0, 1.0, 1.0]);
let mut plt = Plotter::new();
plt.plot2d(pb);
plt.join();
}
Auto Trait Implementations§
impl Freeze for Plotter
impl !RefUnwindSafe for Plotter
impl Send for Plotter
impl Sync for Plotter
impl Unpin for Plotter
impl !UnwindSafe for Plotter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more