Trait plotters::coord::combinators::BindKeyPointMethod
source · [−]pub trait BindKeyPointMethod where
Self: AsRangedCoord, {
fn with_key_point_func<F: Fn(usize) -> Vec<Self::Value> + 'static>(
self,
func: F
) -> WithKeyPointMethod<Self::CoordDescType> { ... }
}
Expand description
Bind an existing coordinate spec with a given key points algorithm. See WithKeyPointMethod for more details.
Provided Methods
fn with_key_point_func<F: Fn(usize) -> Vec<Self::Value> + 'static>(
self,
func: F
) -> WithKeyPointMethod<Self::CoordDescType>
fn with_key_point_func<F: Fn(usize) -> Vec<Self::Value> + 'static>(
self,
func: F
) -> WithKeyPointMethod<Self::CoordDescType>
Bind a existing coordinate spec with a given key points algorithm. See WithKeyPointMethod for more details. Example:
use plotters::prelude::*;
use plotters_bitmap::BitMapBackend;
let mut buffer = vec![0;1024*768*3];
let root = BitMapBackend::with_buffer(&mut buffer, (1024, 768)).into_drawing_area();
let mut chart = ChartBuilder::on(&root)
.build_cartesian_2d(
(0..100).with_key_point_func(|n| (0..100 / n as i32).map(|x| x * 100 / n as i32).collect()),
0..10
).unwrap();
chart.configure_mesh().draw().unwrap();