Skip to content

Instantly share code, notes, and snippets.

@astrieanna
Last active December 22, 2015 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astrieanna/6392487 to your computer and use it in GitHub Desktop.
Save astrieanna/6392487 to your computer and use it in GitHub Desktop.
Making Vega.jl plot
#Pkg.add for JSON
#Pkg.clone for Vega.jl, JSTypes
xs = open("xs.txt","r")
ys = open("ys.txt","r")
xarr = readdlm(xs)
yarr = readdlm(ys)
x2 = Float64[x for x in xarr]
y2 = Float64[y for y in yarr]
using Vega
plot(x = x2,
y = y2,
kind = :bar)
plot(x = x2,
y = y2,
kind = :line)
#you can enter this line by line in the REPL
# or put it in a file
# and include("filename") in the repl
# you'll only get the last plot command to actually run that way tho
#Pkg.add for JSON
#Pkg.clone for Vega.jl, JSTypes
# Run Vega.install()
#read in data
xs = readdlm(open("xs.txt","r"))
ys = readdlm(open("ys.txt","r"))
#Convert to Array{Float64,1}
x2 = Float64[x for x in xarr]
y2 = Float64[y for y in yarr]
#Plot! :)
using Vega
plot(x = x2,
y = y2,
kind = :bar)
plot(x = x2,
y = y2,
kind = :line)
#you can enter this line by line in the REPL
# or put it in a file
# and include("filename") in the repl
# you'll only get the last plot command to actually run that way tho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment