Julia bindings to Vega-Lite



Julia bindings to Vega-Lite

Julia 0.4 Julia 0.5 master (on nightly + release) Coverage
VegaLite VegaLite Build Status Coverage Status

This package provides access to the Vega-Lite high-level visualization grammar (http://vega.github.io/vega-lite/) from Julia.

Vega-Lite is a simpler version of the Vega grammar allowing smaller and more expressive chart specifications. Vega-Lite is intentionaly more limited than Vega, if you need a finer control over the produced graph you can turn instead to the Vega.jl package (https://github.com/johnmyleswhite/Vega.jl). Parts of the VegaLite package (rendering functions, IJulia integration) are based on Vega.jl (thanks !).

Install with Pkg.add("VegaLite") (or Pkg.clone("https://github.com/fredo-dedup/VegaLite.jl.git") until it reaches the official repository). Most functions are documented, with the full list of their properties listed and explained, e.g. type ? config_mark to get the full list of properties of the config_mark function, etc.

The julia functions follow pretty closely the Vega-Lite JSON format: data_values() creates the {"data": {values: { ...} }} part of the spec file, etc.

Only two functions are added:

  • svg(Bool) : sets the drawing mode of the plots, SVG if true, canvas if false. Default = true
  • buttons(Bool) : indicates if the plot should be accompanied with links 'Save as PNG', 'View source' and 'Open in Vega Editor'. Default = true.

Currently, VegaLite.jl works with :

  • IJulia
  • the standard REPL (a browser window will open)
  • Juno (a browser window will open, with experimental support of Juno's PlotPane if you have wkhtmltoimage installed and in the path)

All contributions, PR or issue, are welcome !


  • Plotting a simple line chart: ``` using VegaLite

ts = sort(rand(10)) ys = Float64[ rand()*0.1 + cos(x) for x in ts]

v = data_values(time=ts, res=ys) + # add the data vectors & assign to symbols 'time' and 'res' mark_line() + # mark type = line encoding_x_quant(:time) + # bind x dimension to :time, quantitative scale encoding_y_quant(:res) # bind y dimension to :res, quantitative scale


- Scatterplot, using a DataFrame as the source:

using RDatasets

mpg = dataset("ggplot2", "mpg") # load the 'mpg' dataframe

data_values(mpg) + # add values mark_point() + # mark type = points encoding_x_quant(:Cty) + # bind x dimension to :Cty field in mpg encoding_y_quant(:Hwy) # bind y dimension to :Hwy field in mpg


- A scatterplot, with colors and size settings for the plot:

data_values(mpg) + mark_point() + encoding_x_quant(:Cty, axis=false) + encoding_y_quant(:Hwy, scale=scale(zero=false)) + encoding_color_nominal(:Manufacturer) + # bind color to :Manufacturer, nominal scale config_cell(width=350, height=400)


- A slope graph:

data_values(mpg) + mark_line() + encoding_x_ord(:Year, axis = axis(labelAngle=-45, labelAlign="right"), scale = scale(bandSize=50)) + encoding_y_quant(:Hwy, aggregate="mean") + encoding_color_nominal(:Manufacturer)


- A trellis plot:

data_values(mpg) + mark_point() + encoding_column_ord(:Cyl) + # sets the column facet dimension encoding_row_ord(:Year) + # sets the row facet dimension encoding_x_quant(:Displ) + encoding_y_quant(:Hwy) + encoding_size_quant(:Cty) + encoding_color_nominal(:Manufacturer)


- A table:

data_values(mpg) + mark_text() + encoding_column_ord(:Cyl) + encoding_row_ord(:Year) + encoding_text_quant(:Displ, aggregate="mean") + config_mark(fontStyle="italic", fontSize=12, font="courier")


First Commit


Last Touched

14 days ago


81 commits

Used By: