nu_plugin_plot
A small nu plugin to plot a list as a line graph.
Not yet on crates.io, so you'll have to clone this repository. I assume you have Rust, and are inside a nushell instance.
```console git clone https://github.com/Euphrasiologist/nupluginplot cd nupluginplot
cargo build --release register ./target/release/nupluginplot
plot -h hist -h xyplot -h ```
plot
, hist
, and xyplot
have very similar helps, so I'll print out just plot here.
```console Render an ASCII plot from a list of values.
Usage:
plot {flags}
Flags:
-h, --help - Display the help message for this command
--width
```console
let one = (seq 0.0 0.01 20.0 | math sin) $one | plot
let two = (seq 1.0 0.01 21.0 | math sin) [$one $two] | plot
let three = (seq 2.0 0.01 22.0 | math sin) let four = (seq 3.0 0.01 23.0 | math sin)
[$one $two $three $four] | plot -l -t "Four sine lines!"
[$one $two] | xyplot
[(seq 1 100) (seq 1 100 | reverse)] | xyplot -p
let r1 = (seq 1 100 | each { random integer ..30}) let r2 = (seq 1 100 | each { random integer ..30})
[$r1 $r2] | hist -b
[$r1 $r2] | hist -b --bins 50
let x = (Rscript -e "cat(dnorm(seq(-4, 4, length=100)))" | into string | split row ' ' | into decimal) let y = (Rscript -e "cat(dnorm(seq(-3, 6, length=100)))" | into string | split row ' ' | into decimal)
[$x $y] | plot -bl -t "Two normal distributions" ```
Plot:
Please help me make this better! Submit issues/PR's, happy to chat.
The color rendering inside nushell is slightly confusing - you may notice I've included my own modified copies of textplots
and drawille
in the source code. This is because their color rendering method was not working inside the plugin - I still don't know why.