Crates.io | vl |
lib.rs | vl |
version | 0.0.3 |
source | src |
created_at | 2022-05-02 22:45:53.437087 |
updated_at | 2022-05-09 06:22:11.629181 |
description | A CLI tool to generate Vega-Lite specifications. |
homepage | |
repository | https://github.com/lsh/vl/ |
max_upload_size | |
id | 579384 |
size | 1,822,102 |
A CLI to generate Vega-Lite specifications.
This project is currently a major work in progress so many parts are unrefined or may not work.
The overall goal of this tool is to be useful in quick shell scripts for visualizing data. For anything more involved or long term, consider any of the more mature Vega-Lite bindings.
A spec can either be fed data directly with a file:
vl 'data/cars.json' bar --x='f:Origin' --y='f:Miles_per_Gallon,t:q'
Or it can be piped in:
cat data/cars.json | vl bar --x='f:Origin' --y='f:Miles_per_Gallon,t:q'
Alternatively one can choose to not feed in data at all and just generate the encoding and mark type:
vl bar --x='f:Origin' --y='f:Miles_per_Gallon,t:q'
There is a comma-separated short hand for encodings to allow for quick plotting (of the format key:value
):
key | value |
---|---|
a or aggregate |
string |
b or bin |
bool |
f or field |
string |
t or type |
string * |
u or timeUnit |
string |
alternatively any key:value
pair should just be passed through as well.
*For type there are also the following shorthands:
char | type |
---|---|
q |
quantitative |
t |
temporal |
o |
ordinal |
n |
nominal |
g |
geojson |
vl
can make use of a config file located at ~/.config/vl/config.json
. The config file takes any values that Vega-Lite's config
parameter takes.
If you would like to ignore your config file for a specific plot, you can plot with:
vl --bare [...]
This tool is particularly useful with a terminal that allows inline graphics such as Kitty along with the Vega-Lite CLI. With the above, one can run:
cat data/cars.json | vl bar --x='f:Origin' --y='f:Miles_per_Gallon,t:q' | vl2png | icat
where icat is replaced by whatever your terminal's graphic representation command is.