Expand description
Terminal plotting library for using in CLI applications. Should work well in any unicode terminal with monospaced font.
It is inspired by TextPlots.jl which is inspired by Drawille.
Currently it features only drawing line plots on Braille canvas, but could be extended to support other canvas and chart types just like UnicodePlots.jl or any other cool terminal plotting library.
Contributions are very much welcome!
§Usage
[dependencies]
textplots = "0.8"
use textplots::{Chart, Plot, Shape};
println!("y = sin(x) / x");
Chart::default()
.lineplot(&Shape::Continuous(Box::new(|x| x.sin() / x)))
.display();
It will display something like this:
Default viewport size is 120 x 60 points, with X values ranging from -10 to 10.
You can override the defaults calling new
.
use textplots::{Chart, Plot, Shape};
println!("y = cos(x), y = sin(x) / 2");
Chart::new(180, 60, -5.0, 5.0)
.lineplot(&Shape::Continuous(Box::new(|x| x.cos())))
.lineplot(&Shape::Continuous(Box::new(|x| x.sin() / 2.0)))
.display();
You could also plot series of points. See Shape and examples for more details.
Modules§
Structs§
- Chart
- Controls the drawing.
Enums§
- Label
Format - Specifies label format.
Default value is
LabelFormat::Value
. - Line
Style - Specifies line style.
Default value is
LineStyle::Dotted
. - Shape
- Specifies different kinds of plotted data.
- Tick
Display - Specifies density of labels on the Y axis between ymin and ymax.
Default value is
TickDisplay::None
.
Traits§
- Axis
Builder - Provides a builder interface for styling axis.
- Color
Plot - Provides an interface for drawing colored plots.
- Label
Builder - Plot
- Provides an interface for drawing plots.
- Tick
Display Builder - Provides an interface for adding tick labels to the y-axis