Documentation updated

This commit is contained in:
Giorgio Calderone 2018-10-20 20:09:05 +02:00
parent a832c501de
commit a4e2f251c2
2 changed files with 149 additions and 142 deletions

View File

@ -880,24 +880,31 @@ end
noise = randn(length(x))./2; noise = randn(length(x))./2;
e = 0.5 * fill(1, size(x)); e = 0.5 * fill(1, size(x));
@gp verb=2 x y :aa "plot \\\$aa w l" "pl \\\$aa u 1:(2*\\\$2) w l" name = "\\\$MyDataSet1"
@gp x y name "plot \$name w l" "pl \$name u 1:(2*\\\$2) w l"
@gsp randn(Float64, 30, 50) @gsp randn(Float64, 30, 50)
@gp randn(Float64, 30, 50) "w image" @gp randn(Float64, 30, 50) "w image"
@gsp x y y
@gp("set key horizontal", "set grid", @gp("set key horizontal", "set grid",
xrange=(-7,7), ylabel="Y label", xrange=(-7,7), ylabel="Y label",
x, y, "w l t 'Real model' dt 2 lw 2 lc rgb 'red'", x, y, "w l t 'Real model' dt 2 lw 2 lc rgb 'red'",
x, y+noise, e, "w errorbars t 'Data'"); x, y+noise, e, "w errorbars t 'Data'")
@gp "f(x) = a * sin(b + c*x); a = 1; b = 1; c = 1;" :- @gp "f(x) = a * sin(b + c*x); a = 1; b = 1; c = 1;" :-
@gp :- x y+noise e :aa :- @gp :- x y+noise e name :-
@gp :- "fit f(x) \\\$aa u 1:2:3 via a, b, c;" :- @gp :- "fit f(x) \$name u 1:2:3 via a, b, c;" :-
@gp :- "set multiplot layout 2,1" :- @gp :- "set multiplot layout 2,1" :-
@gp :- "plot \\\$aa w points tit 'Data'" ylab="Data and model" :- @gp :- "plot \$name w points" ylab="Data and model" :-
@gp :- "plot \\\$aa u 1:(f(\\\$1)) w lines tit 'Best fit'" :- @gp :- "plot \$name u 1:(f(\\\$1)) w lines" :-
@gp :- 2 xlab="X label" ylab="Residuals" :- @gp :- 2 xlab="X label" ylab="Residuals" :-
@gp :- "plot \\\$aa u 1:((f(\\\$1)-\\\$2) / \\\$3):(1) w errorbars notit" @gp :- "plot \$name u 1:((f(\\\$1)-\\\$2) / \\\$3):(1) w errorbars notit"
# Retrieve values fr a, b and c
a = parse(Float64, gpeval("print a"))
b = parse(Float64, gpeval("print b"))
c = parse(Float64, gpeval("print c"))
``` ```
### Display an image ### Display an image

View File

@ -47,13 +47,13 @@ function gp_test()
x, y+noise, e, "w errorbars t 'Data'") x, y+noise, e, "w errorbars t 'Data'")
@gp "f(x) = a * sin(b + c*x); a = 1; b = 1; c = 1;" :- @gp "f(x) = a * sin(b + c*x); a = 1; b = 1; c = 1;" :-
@gp :- x y+noise e "\$aa" :- @gp :- x y+noise e name :-
@gp :- "fit f(x) \$aa u 1:2:3 via a, b, c;" :- @gp :- "fit f(x) $name u 1:2:3 via a, b, c;" :-
@gp :- "set multiplot layout 2,1" :- @gp :- "set multiplot layout 2,1" :-
@gp :- "plot \$aa w points" ylab="Data and model" :- @gp :- "plot $name w points" ylab="Data and model" :-
@gp :- "plot \$aa u 1:(f(\$1)) w lines" :- @gp :- "plot $name u 1:(f(\$1)) w lines" :-
@gp :- 2 xlab="X label" ylab="Residuals" :- @gp :- 2 xlab="X label" ylab="Residuals" :-
@gp :- "plot \$aa u 1:((f(\$1)-\$2) / \$3):(1) w errorbars notit" @gp :- "plot $name u 1:((f(\$1)-\$2) / \$3):(1) w errorbars notit"
# Retrieve values fr a, b and c # Retrieve values fr a, b and c
a = parse(Float64, gpeval("print a")) a = parse(Float64, gpeval("print a"))