Function x
Source pub fn x(end_x: f64) -> XEnd
Expand description
sets the absolute max value for x
3fn main() {
4 let plot = Plot::new((|x: f64| x.tanh(), x(6.)));
5 plot.show()
6}
More examples
Hide additional examples
3fn main() {
4 let plot = Plot::new((|x: f64| 1. / (1. + (-x).exp()), x(6.)));
5 plot.show()
6}
examples/polynomial.rs (
line 5)
3fn main() {
4 let poly = Polynomial::new(&[2., 3., 1.], &[2., 3., 2.]);
5 let plot = Plot::new((poly, x(10.)));
6 plot.show();
7}
3fn main() {
4 let plot = Plot::new((|x: f64| x.powf(3.) + x.powf(2.) - 0.08, x(1.)));
6 plot.show();
7}
examples/title_and_axis.rs (
line 4)
3fn main() {
4 let mut plot = Plot::new((|x: f64| x.cos(), x(6.)));
5
6 plot.set_title("cosine wave");
7 plot.set_xlabel("x axis");
8 plot.set_ylabel("y axis");
9 plot.show();
10}
examples/custom_scaling.rs (
line 4)
3fn main() {
4 let mut plot = Plot::new((|x: f64| x.cos(), x(5.)));
5 plot.set_desc(Desc {
6 min_steps_x: 6.,
7 spacing_x: 47.,
8 ..Default::default()
9 });
10 plot.show();
11}
Additional examples can be found in: