diff --git a/v1.2.0/advanced/index.html b/v1.2.0/advanced/index.html index 8ac1442..0b5505d 100644 --- a/v1.2.0/advanced/index.html +++ b/v1.2.0/advanced/index.html @@ -17,9 +17,9 @@ name = "\$MyDataSet1" a = vars.a, b = vars.b, c = vars.c)
┌ Info: Best fit values:
-│ a = 1.53507096513964
-│ b = 0.333804739506457
-└ c = 0.701159811567446Gnuplot.jl can draw multiple plots in the same figure by exploiting the multiplot command. Each plot is identified by a positive integer number, which can be used as argument to @gp to redirect commands to the appropriate plot.
Recycling data from the previous example we can plot both data and best fit model (in plot 1) and residuals (in plot 2):
@gp "f(x) = a * sin(b + c*x)"
+│ a = 1.47753770412003
+│ b = 0.333174808662086
+└ c = 0.69826612931412Gnuplot.jl can draw multiple plots in the same figure by exploiting the multiplot command. Each plot is identified by a positive integer number, which can be used as argument to @gp to redirect commands to the appropriate plot.
Recycling data from the previous example we can plot both data and best fit model (in plot 1) and residuals (in plot 2):
@gp "f(x) = a * sin(b + c*x)"
@gp :- "a=$(vars.a)" "b=$(vars.b)" "c=$(vars.c)"
@gp :- name=>(x, y, err)
@gp :- "set multiplot layout 2,1"
@@ -77,7 +77,192 @@ sinc2d(x,y) = sin.(sqrt.(x.^2 + y.^2))./sqrt.(x.^2+y.^2)
fxy = [sinc2d(x,y) for x in x, y in y]
@gsp :- 2 x y fxy "w pm3d notit"
Gnuplot.jl can handle multiple sessions, i.e. multiple gnuplot processes running simultaneously. Each session is identified by an ID (sid::Symbol, in the documentation).
In order to redirect commands to a specific session simply insert a symbol into your @gp or @gsp call, e.g.:
@gp :GP1 "plot sin(x)" # opens first window
@gp :GP2 "plot sin(x)" # opens secondo window
-@gp :- :GP1 "plot cos(x)" # add a plot on first windowThe session ID can appear in every position in the argument list, but only one ID can be present in each call. If the session ID is not specified the :default session is used.
The names of all current sessions can be retrieved with session_names():
julia> println(session_names())
+@gp :- :GP1 "plot cos(x)" # add a plot on first window
+
+
+The session ID can appear in every position in the argument list, but only one ID can be present in each call. If the session ID is not specified the :default session is used.
The names of all current sessions can be retrieved with session_names():
julia> println(session_names())
[:default, :GP1, :GP2]To quit a specific session use Gnuplot.quit():
julia> Gnuplot.quit(:GP1)
0The output value is the exit status of the underlying gnuplot process.
You may also quit all active sessions at once with Gnuplot.quitall():
julia> Gnuplot.quitall()Gnuplot.jl provides a facility to compute (see hist() function) an histogram. It allows to set the range to consider (range= keyword) and either the bin size (bs=) or the total number of bins (nbins=) in the histogram (see hist() documentation for further information) and return a Gnuplot.Histogram1D structure, whose content can be visualized as follows:
x = randn(1000);
h = hist(x, range=3 .* [-1,1], bs=0.5)
@@ -101,5 +286,163721 @@ for direction in [-1,1]
@gsp :- frame x y direction * factor .* fxy "w pm3d notit" :-
end
end
-@gspHere the frame variable is used as multiplot index. The animation can be saved in a GIF file with:
save(term="gif animate size 480,360 delay 5", output="assets/animation.gif")
When gnuplot commands are passed to @gp or @gsp they are stored in a session for future use, or to be saved in Gnuplot scripts. If you simply wish to execute a command without storing it in the session, and possibly retrieve a value, use gpexec. E.g., to retrieve the value of a gnuplot variable:
julia> gpexec("print GPVAL_TERM")
-"unknown"You may also provide a session ID as first argument (see Multiple sessions) to redirect the command to a specific session.
Alternatively you may start the The gnuplot REPL to type commands directly from the Julia prompt.
The Gnuplot.jl package comes with a built-in REPL mode to directly send commands to the underlying gnuplot process. Since the REPL is a global resource, the gnuplot mode is not enabled by default. You can start it with:
Gnuplot.repl_init(start_key='>')The customizable start_key character is the key which triggers activation of the REPL mode. To quit the gnuplot REPL mode hit the backspace key.
A "dry session" is a session with no underlying gnuplot process. To enable dry sessions type:
Gnuplot.options.dry = true;before starting a session (see also Options). Note that the dry option is a global one, i.e. it affects all sessions started after setting the option.
Clearly, no plot can be generated in dry sessions. Still, they are useful to run Gnuplot.jl code without raising errors (no attempt will be made to communicate with the underlying process). Moreover, Gnuplot scripts can also be generated in a dry session, without the additional overhead of sending data to the gnuplot process.
If a gnuplot process can not be started the package will print a warning, and automatically enable dry sessions.
Settings
This document was generated with Documenter.jl on Friday 17 April 2020. Using Julia version 1.4.0.