API
Exported symbols
The list of Gnuplot.jl exported symbols is as follows:
Gnuplot.@gp — Macro@gp args...The @gp macro, and its companion @gsp for 3D plots, allows to send data and commands to the gnuplot using an extremely concise syntax. The macros accepts any number of arguments, with the following meaning:
one, or a group of consecutive, array(s) build up a dataset. The different arrays are accessible as columns 1, 2, etc. from the
gnuplotprocess. The number of required input arrays depends on the chosen plot style (seegnuplotdocumentation);a string occurring before a dataset is interpreted as a
gnuplotcommand (e.g.set grid);a string occurring immediately after a dataset is interpreted as a plot element for the dataset, by which you can specify
usingclause,withclause, line styles, etc.. All keywords may be abbreviated following gnuplot conventions. Moreover, "plot" and "splot" can be abbreviated to "p" and "s" respectively;the special symbol
:-, whose meaning is to avoid starting a new plot (if given as first argument), or to avoid immediately running all commands to create the final plot (if given as last argument). Its purpose is to allow splitting one long statement into multiple (shorter) ones;any other symbol is interpreted as a session ID;
an
Int(> 0) is interpreted as the plot destination in a multi-plot session (this specification applies to subsequent arguments, not previous ones);an input in the form
keyword=valueis interpreted as a keyword/value pair. The accepted keywords and their corresponding gnuplot commands are as follows:xrange=[low, high]=>"set xrange [low:high];yrange=[low, high]=>"set yrange [low:high];zrange=[low, high]=>"set zrange [low:high];cbrange=[low, high]=>"set cbrange[low:high];key="..."=>"set key ...";title="..."=>"set title "..."";xlabel="..."=>"set xlabel "..."";ylabel="..."=>"set ylabel "..."";zlabel="..."=>"set zlabel "..."";xlog=true=>set logscale x;ylog=true=>set logscale y;zlog=true=>set logscale z.
All Keyword names can be abbreviated as long as the resulting name is unambiguous. E.g. you can use xr=[1,10] in place of xrange=[1,10];
- an input in the form
"name"=>(array1, array2, etc...)is interpreted as a named dataset.
Gnuplot.@gsp — Macro@gsp args...This macro accepts the same syntax as @gp, but produces a 3D plot instead of a 2D one.
Gnuplot.save — Functionsave(sid::Symbol; term="", output="")
save(sid::Symbol, script_filename::String, ;term="", output="")
save(; term="", output="")
save(script_filename::String ;term="", output="")Export a (multi-)plot into the external file name provided in the output= keyword. The gnuplot terminal to use is provided through the term= keyword.
If the script_filename argument is provided a gnuplot script will be written in place of the output image. The latter can then be used in a pure gnuplot session (Julia is no longer needed) to generate exactly the same original plot.
If the sid argument is provided the operation applies to the corresponding session.
Non-exported symbols
The following functions are not exported by the Gnuplot.jl package since they are typically not used in every day work, or aimed to debugging purposes. Still, they can be useful in some case, hence they are documented here.
In order to call these functions you should add the Gnuplot. prefix to the function name.
Gnuplot.exec — FunctionGnuplot.exec(sid::Symbol, command::String)
Gnuplot.exec(command::String)Execute the gnuplot command command on the underlying gnuplot process of the sid session, and return the results as a Vector{String}. If a gnuplot error arises it is propagated as an ErrorException.
The sid argument is (optional): if not given, :default is used.
Examples:
Gnuplot.exec("print GPVAL_TERM")
Gnuplot.exec("plot sin(x)")Gnuplot.gpversion — FunctionGnuplot.gpversion()Returns the gnuplot application version.
Raise an error if version is < 4.7 (required to use data blocks).
Gnuplot.quit — FunctionGnuplot.quit(sid::Symbol)Quit the session identified by sid and the associated gnuplot process (if any).
Gnuplot.quitall — FunctionGnuplot.quitall()Quit all the sessions and the associated gnuplot processes.
Gnuplot.version — FunctionGnuplot.version()Returns the Gnuplot.jl package version.