An easy to use and simple gnuplot
wrapping that allows you
to:
- perform direct rendering of Gnuplot plots from Julia,
- create and save Gnuplot scripts with embedded data,
- easily export Gnuplot figures.
using GnuplotScripting
# create a gnuplot script
#
gp = GnuplotScript()
# Fake data
#
X=[-pi:0.1:pi;];
Ys =sin.(X);
Yc =cos.(X);
# embed data into the script
#
id=register_data(gp,hcat(X,Ys,Yc))
# usual gnuplot command
#
free_form(gp,"replot '$id' u 1:3 w l t 'cos'")
free_form(gp,"replot '$id' u 1:2 w l t 'sin'")
# png export of the fig
#
export_png("fig.png",gp)
# write gnuplot script
#
write_script("gnuplot_script.gp",gp)
That's it!
After running the previous code you will get a nearly immediate plot
of your figure, a fig.png
image file
and a gnuplot script gnuplot_script.gp
with embedded data you can
rerun when you want.