pub enum Plot<'a, P>where
P: IntoPoint,{
Area(PlotSettings<'a, P>),
Line(PlotSettings<'a, P>),
Scatter(PlotSettings<'a, P>),
}Expand description
Plot for rendering data
Variants§
Area(PlotSettings<'a, P>)
Stacked area plot
Line(PlotSettings<'a, P>)
Line plot
Scatter(PlotSettings<'a, P>)
Scatter plot
Implementations§
Source§impl<'a, P> Plot<'a, P>where
P: IntoPoint,
impl<'a, P> Plot<'a, P>where
P: IntoPoint,
Sourcepub fn area(name: &'a str, data: &'a [P]) -> Self
pub fn area(name: &'a str, data: &'a [P]) -> Self
Create a new area plot
Examples found in repository?
examples/area.rs (line 13)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
let page = Page::new().chart(
Chart::new()
.title("Area Plot")
.domain(&data_a[..])
.axis("X Axis", Edge::Bottom)
.axis("Y Axis", Edge::Left)
.axis("", Edge::Right)
.plot(Plot::area("Series A", &data_a))
.plot(Plot::area("Series B", &data_b)),
);
print!("{page}");
}Sourcepub fn line(name: &'a str, data: &'a [P]) -> Self
pub fn line(name: &'a str, data: &'a [P]) -> Self
Create a new line plot
Examples found in repository?
examples/line.rs (line 13)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39), (210, 43)];
let page = Page::new().chart(
Chart::new()
.title("Line Plot")
.domain(Domain::from(&data_a[..]).including(&data_b))
.axis("X Axis", Edge::Bottom)
.axis("Y Axis", Edge::Left)
.axis("", Edge::Right)
.plot(Plot::line("Series A", &data_a).label())
.plot(Plot::line("Series B", &data_b)),
);
print!("{page}");
}Sourcepub fn scatter(name: &'a str, data: &'a [P]) -> Self
pub fn scatter(name: &'a str, data: &'a [P]) -> Self
Create a new scatter plot
Examples found in repository?
examples/scatter.rs (line 13)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
let page = Page::new().chart(
Chart::new()
.title("Scatter Plot")
.domain(&data_a[..])
.axis("X Axis", Edge::Bottom)
.axis("Y Axis", Edge::Left)
.axis("", Edge::Right)
.plot(Plot::scatter("Series A", &data_a).label())
.plot(Plot::scatter("Series B", &data_b)),
);
print!("{page}");
}Sourcepub fn label(self) -> Self
pub fn label(self) -> Self
Add labels to plot
Examples found in repository?
examples/scatter.rs (line 13)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
let page = Page::new().chart(
Chart::new()
.title("Scatter Plot")
.domain(&data_a[..])
.axis("X Axis", Edge::Bottom)
.axis("Y Axis", Edge::Left)
.axis("", Edge::Right)
.plot(Plot::scatter("Series A", &data_a).label())
.plot(Plot::scatter("Series B", &data_b)),
);
print!("{page}");
}More examples
examples/line.rs (line 13)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39), (210, 43)];
let page = Page::new().chart(
Chart::new()
.title("Line Plot")
.domain(Domain::from(&data_a[..]).including(&data_b))
.axis("X Axis", Edge::Bottom)
.axis("Y Axis", Edge::Left)
.axis("", Edge::Right)
.plot(Plot::line("Series A", &data_a).label())
.plot(Plot::line("Series B", &data_b)),
);
print!("{page}");
}Trait Implementations§
Auto Trait Implementations§
impl<'a, P> Freeze for Plot<'a, P>
impl<'a, P> RefUnwindSafe for Plot<'a, P>where
P: RefUnwindSafe,
impl<'a, P> Send for Plot<'a, P>where
P: Sync,
impl<'a, P> Sync for Plot<'a, P>where
P: Sync,
impl<'a, P> Unpin for Plot<'a, P>
impl<'a, P> UnwindSafe for Plot<'a, P>where
P: RefUnwindSafe,
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