Gnuplot Example

Gnuplot From Bash

Install gnuplot.

apt-get -qq update
apt-get install gnuplot gnuplot-nox
27.3s
Bash in Python

Upload Cavendish example data. Data can also be downloaded.

cavendish.data

Create a gnuplot script file, and run it. You can also upload a script file, however this will make it a bit more complicated to use uploaded data files.

echo 'set terminal svg
set output "/results/out.svg
set title "Cavendish Data"
set xlabel "Time (s)"
set ylabel "Angle (mrad)"
set grid
plot _ with lines title "Cavendish"' > gnu.script
gnuplot gnu.script
0.9s
Bash in Python

Julia Interface

apt-get -qq update
apt-get install gnuplot gnuplot-nox
18.2s
Bash in Julia
]add Gnuplot; precompile
103.5s
using Gnuplot
x = -2pi:0.1:2pi
approx = fill(0., length(x));
@gp tit="Polynomial approximation of sin(x)" key="opaque" linetypes(:Blues_4)
@gp :- "set encoding utf8" raw"""set xtics ('-π' -pi, '-π/2' -pi/2, 0, 'π/2' pi/2, 'π' pi)"""
@gp :- xr=3.8.*[-1, 1] yr=[-1.5,1.5] "set grid front"
@gp :- x sin.(x) approx .+=  x          "w filledcurve t 'n=0' lt 1"
@gp :- x sin.(x) approx .+= -x.^3/6     "w filledcurve t 'n=1' lt 2"
@gp :- x sin.(x) approx .+=  x.^5/120   "w filledcurve t 'n=2' lt 3"
@gp :- x sin.(x) approx .+= -x.^7/5040  "w filledcurve t 'n=3' lt 4"
@gp :- x sin.(x)                        "w l t 'sin(x)' lw 2 lc rgb 'black'"
save(term="svg size 640,480",output="/results/out.svg")
60.3s
Runtimes (2)