Show a graph on the terminal using block or braille characters.
awk -f fancy_graph.awk | braille -r -1:1 -c 5
# fancy_graph.awk
BEGIN {
pi = atan2(0, -1);
for (i = (-20 * pi); i < (20 * pi); i++) {
print 100 * sin(i / 4) / i;
}
}
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣀⣤⣤⣤⣀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣶⣄⠀⠀⠀⠀⠀⠀⠀⣀⣤⣤⣤⣄⡀
⠉⠉⠉⠉⠉⠉⠉⠻⢿⣿⣿⠿⠋⠉⠉⠉⠉⠉⠉⠹⣿⣿⣿⣿⣿⠋⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⢿⣿⣿⣿⣿⡟⠉⠉⠉⠉⠉⠉⠉⠻⢿⣿⡿⠟⠋⠉⠉⠉⠉⠉⠉
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
awk -f fancy_graph_small.awk | braille -c 10
# fancy_graph_small.awk
BEGIN {
pi = atan2(0, -1);
for (i = -8 * pi; i < 8 * pi; i++) {
if (i != 0) {
print sin(i) / i;
}
}
}
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣀⠀⠀⣠⡀⠀⣰⡆⠀⢸⣿⣿⡆⠀⣼⡄⠀⢠⡀⠀⢀⡀⠀⠀
⠹⠟⠉⠹⠟⠉⠹⡿⠉⠙⣿⠉⠉⠉⢹⣿⠉⠹⡿⠉⠙⠿⠉⠉⠻⠃
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⠀⠀⠀⠸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
jq -nrf curve.jq | braille \
--style auto \
--per 2 \
--kind braille-columns \
10
# curve.jq
(-1 | acos) as $pi
| range(-8 * $pi; 8 * $pi)
| [
(. / 5 | cos),
(. / 4 | sin)
] | @tsv
⠀⠀⣰⣿⡄⠀⠀⠀⠀⠀⠀⠠⠉⠑⣀⣾⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢠⣿⣿⣿⠀⠀⠀⠀⠀⠠⠁⠀⠀⡸⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣼⣿⣿⣿⡇⠀⠀⠀⠀⠂⠀⠀⢀⠀⢻⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀
⢂⣿⣿⣿⣿⣿⠀⠀⠀⠐⠀⠀⠀⡀⠀⠈⣿⣿⡇⠀⠀⠀⠀⠀⠀⠄
⡘⣿⣿⣿⣿⣿⡆⠀⠀⠂⠀⠀⠀⠀⠀⠀⢹⣿⣿⠀⠀⠀⠀⠀⠠⠀
⠀⢻⣿⣿⣿⣿⣧⠀⠐⠀⠀⠀⠈⠀⠀⠀⠈⣿⣿⡆⠀⠀⠀⠀⠄⠂
⠀⠘⣿⣿⣿⣿⣿⡄⠁⠀⠀⠀⠂⠀⠀⠀⠀⢸⣿⣧⠀⠀⠀⠠⠠⠀
⠀⠀⢻⣿⣿⣿⣿⣏⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⣿⣿⡄⠀⠀⠄⠄⠀
⠀⠀⠈⣿⣿⣿⡿⠀⠄⠀⠀⠂⠀⠀⠀⠀⠀⠀⠸⣿⣧⠀⡐⠠⠀⠀
⠀⠀⠀⠘⢿⡿⠁⠀⠐⣀⠌⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⠶⡠⠂⠀⠀
After installing rust
:
cargo install --git https://github.com/mklein994/braille.git
For help on the various options, see braille --help
or run cargo doc
on the local clone and browse the API docs.
The --modeline
option pairs nicely with jq-repl.