Function line_plot

Source
pub fn line_plot<'a>(data: &'a Vec<(f64, f64)>) -> LinePlotBuilder<'a>
Expand description

Displays a line graph of some given points.

§Example

use cgrustplot::plots::line_plot::line_plot;
 
let points = vec![(0., 0.), (1., 1.), (2., 4.)];
line_plot(&points).print();
 
// Standard Output:
//       │                                                    _―――――――
// 3.680 ┼                                                _――‾        
//       │                                            _――‾            
// 2.720 ┼                                        _――‾                
//       │                                    _――‾                    
// 1.760 ┼                                _――‾                        
//       │                         _―――――‾                            
// 0.800 ┼             _――――――――――‾                                   
//       │――――――――――――‾                                               
// -0.16 ┼                                                            
//       └┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────────
//        -0.180 0.1000 0.3800 0.6600 0.9400 1.2200 1.5000 1.7800     

§Options

  • data - Input data of a list of points.
  • domain - Specified domain to plot the data over. Default is computed.
  • range - Specified range to display the data over. Default is computed.
  • domain_padding - Proportion of the width of the domain to be padded with. Default is 0.1.
  • range_padding - Proportion of the height of the range to be padded with. Default is 0.1.
  • size - Dimensions (in characters) of the outputted plot. Default is (60, 10).
  • title - Optional title for the plot. Default is None.
  • axes - Whether or not to display axes and axes labels. Default is true.