Simon Danisch / Oct 01 2019
Remix of VegaLite Environment by JEJulia Environments
Julia 1.3 VegaLite Environment
Update old Julia Image, and remove OpenGL plotting libraries to make image lighter!
]up; dev VegaLite; add VegaDatasets
VegaLite has problems building due npm running into file permissions, so we need to do it manually:
apt-get update apt-get install npm libpixman-1-dev libcairo2-dev libpango1.0-dev libjpeg-dev build-essential -y cd /root/.julia/dev/VegaLite/deps npm install canvas --build-from-source --production --no-package-lock --no-optional -y npm install --scripts-prepend-node-path=true --production --no-package-lock --no-optional -y
Now, one can use VegaLite,
using VegaLite, VegaDatasets vega_plot = dataset("cars") |> ( :point, x = :Horsepower, y = :Miles_per_Gallon, color = :Origin, width = 650, height = 400 ) |> VegaLite.interactive()
One can also write out a json file to /results/
, and it will display correctly if it contains valid Vega json and ends with the extension vl.json
:
open("/results/test.vl.json", "w") do io show(io, MIME"application/vnd.vegalite.v3+json"(), vega_plot) end
Loading viewer…
Or one can write out NamedTuples as JSON the same way:
data = ( width = 650, height = 400, data = ( url = "https://vega.github.io/vega-datasets/data/us-10m.json", format = (type = "topojson", feature = "counties") ), transform = [( lookup = "id", from = ( data = ( url = "https://vega.github.io/vega-datasets/data/unemployment.tsv", ), key = "id", fields = ["rate"] ) )], projection = (type = "albersUsa",), mark = "geoshape", encoding = (color = (field = "rate", type = "quantitative"),) ) using JSON open("/results/test.vl.json", "w") do io JSON.print(io, data) end
Loading viewer…