Skip to content
/ vl Public

A CLI tool for generating Vega-Lite specifications.

License

Notifications You must be signed in to change notification settings

lsh/vl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VL

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.

Usage

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

Config

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.

About

A CLI tool for generating Vega-Lite specifications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages