Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dlozeve/uniplot
Unicode plotting tool for displaying CSV data directly in your terminal
https://github.com/dlozeve/uniplot
console csv plotting terminal unicode
Last synced: 25 days ago
JSON representation
Unicode plotting tool for displaying CSV data directly in your terminal
- Host: GitHub
- URL: https://github.com/dlozeve/uniplot
- Owner: dlozeve
- License: mit
- Created: 2021-04-29T17:37:40.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T19:32:04.000Z (over 1 year ago)
- Last Synced: 2024-11-13T10:49:33.797Z (3 months ago)
- Topics: console, csv, plotting, terminal, unicode
- Language: Scheme
- Homepage:
- Size: 138 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
* Uniplot
Unicode plotting tool for displaying CSV data directly in your
terminal.#+ATTR_HTML: :width 100% :style margin-left: auto; margin-right: auto;
[[./images/demo.png]](source: [[https://ourworldindata.org/grapher/annual-co2-emissions-per-country?tab=chart&time=1850..latest&country=CHN~USA~Europe][Our World in Data]])
** Features
- Braille canvas for plotting
- Line plots
- Axes and tick labels showing ranges
- Optional title, x-axis label, and legend
- Input data loading from a CSV file** Usage
Start from a well-formatted CSV file:
#+begin_src sh
$ head data/annual_co2_emissions.csv
Year,United States,China,France,Germany,Italy,United Kingdom
1750,,,,,,9.350528e6
1751,,,,,,9.350528e6
1752,,,,,,9.354192e6
1753,,,,,,9.354192e6
1754,,,,,,9.357856e6
1755,,,,,,9.36152e6
1756,,,,,,1.0006384e7
1757,,,,,,1.0010048e7
1758,,,,,,1.0013712e7
#+end_srcUniplot reads the standard input for a CSV file, and its behaviour
depends on the number of columns:
- If there is only one column, it will plot its values against a
simple range index.
- For two or more columns, it will use the first column for the
x-axis, and plot the next columns with different colors against it.You can use a tool like Awk or [[https://github.com/BurntSushi/xsv][xsv]] to select the columns you want to
plot:
#+begin_src sh
awk -F, -v OFS=, '{print $1, $4, $5, $6, $7}' data/annual_co2_emissions.csv | uniplot
#+end_srcAnd you can add a title by giving an argument to ~uniplot~:
#+begin_src sh
awk -F, -v OFS=, '{print $1, $4, $5, $6, $7}' data/annual_co2_emissions.csv | uniplot "Annual CO₂ emissions (kg)"
#+end_src** Build
Install [[https://cons.io/][Gerbil Scheme]].
Uniplot depends on [[https://github.com/dlozeve/fancy][Fancy]] for colors and display.
#+begin_src sh
gxpkg install github.com/dlozeve/fancy
gxpkg install github.com/dlozeve/uniplot
#+end_srcOr manually clone [[https://github.com/dlozeve/fancy][Fancy]] and [[https://github.com/dlozeve/uniplot][Uniplot]] and run ~./build.ss~ in the root
directory of each repository.** References
- [[https://github.com/Evizero/UnicodePlots.jl][UnicodePlots.jl]] in [[https://julialang.org/][Julia]]