Micah P. Dombrowski / Sep 08 2018

Full Julia 0.7 Env

Install Julia packages and deps.

apt-get update > /dev/null
apt-get install -y --no-install-recommends unzip patch imagemagick \
  build-essential cmake autotools-dev autoconf \
  libxt6 libxrender1 libgl1-mesa-glx libqt5widgets5 `# for GR` \
  libvulkan-dev mesa-vulkan-drivers vulkan-utils mesa-common-dev mesa-utils \
  xorg-dev libglfw3-dev `# for Makie` \
  libhttp-parser2.7.1 # for PlotlyJS
apt-get clean
rm -r /var/lib/apt/lists/* # Clear package list so it isn't stale
julia -E 'using Pkg

pkg"update"
pkg"add DataFrames CSV"
pkg"add HTTP Blink WebIO GR PlotlyJS#master Plots"
pkg"add ImageMagick Makie"'
julia -E 'using Pkg; pkg"precompile"'

Install static build of FFmpeg for making animations.

wget --progress=dot:giga \
  https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz
tar -Jxf ffmpeg-release-64bit-static.tar.xz

IDIR="/usr/local/ffmpeg"
mv ffmpeg-4.0.2-64bit-static $IDIR
for ex in $IDIR/{ffmpeg,ffmpeg-10bit,ffprobe}; do
  ln -s $ex /usr/local/bin/
done

rm *.xz

Test.

ffmpeg -version
45.0s
using Plots
Plots.plotlyjs()

#using ..Coders

using JSON
const __nj_json_values_cache = Dict()
function json_write(value::Any, path::String, kind::String)
  key = hash(value)
  if haskey(__nj_json_values_cache, key)
    json_string = __nj_json_values_cache[key]
  else
    json_string = JSON.json(value)
    __nj_json_values_cache[key] = json_string
  end
  write(path, json_string)
  Dict{Any,Union{Nothing,String,Dict}}(
    :"content-type" => "application/json", :kind => kind, :metadata => nothing)
end


foo = Plots.plot([1,7,4])

show(io::IO, m, val::Plots.Plot) = function
  if Plots.CURRENT_BACKEND.sym == :gr
    io = open(io, "w")
    Base.invokelatest(show, io, MIME("image/svg+xml"), plot)
    close(io)
    Dict(:"content-type" => "image/svg+xml", :kind => "file")
  else
    Plots.prepare_output(foo)
data = []
for series in foo.series_list
  append!(data, Plots.plotly_series(foo, series))
end

layout = Plots.plotly_layout(foo)

plotly_data = Dict(:data => data, :layout => layout)

base = json_write(plotly_data, "/results/blarg.json", "plotly")
base[:metadata] = Dict(:height => get(layout, :height, nothing))

base
  
show(io::IO, m::MIME"", val::)
using Plots
Plots.gr()

Plots.plot([1,7,4])