This commit is contained in:
Giorgio Calderone 2020-03-17 00:20:19 +01:00
parent a73d0d0dca
commit 605ad0cfda

View File

@ -6,6 +6,7 @@ import Base.reset
import Base.println import Base.println
import Base.iterate import Base.iterate
import Base.convert import Base.convert
import Base.string
export @gp, @gsp, save, contourlines, hist export @gp, @gsp, save, contourlines, hist
@ -66,6 +67,11 @@ state.dry = false
# │ LOW LEVEL FUNCTIONS │ # │ LOW LEVEL FUNCTIONS │
# ╰───────────────────────────────────────────────────────────────────╯ # ╰───────────────────────────────────────────────────────────────────╯
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
function string(c::ColorTypes.RGB)
return string(float(c.r)*255) * " " * string(float(c.g)*255) * " " * string(float(c.b)*255)
end
""" """
# CheckGnuplotVersion # CheckGnuplotVersion
@ -695,7 +701,7 @@ end
""" """
`@gp args...` `@gp args...`
The `@gp` macro, and its companion `@gsp` (for `splot` operations) allows to exploit all of the **Gnuplot** package functionalities using an extremely efficient and concise syntax. Both macros accept the same syntax, as described below. The `@gp` macro (and its companion `@gsp`, for `splot` operations) allows to exploit all of the **Gnuplot** package functionalities using an extremely efficient and concise syntax. Both macros accept the same syntax, as described below.
The macros accepts any number of arguments, with the following meaning: The macros accepts any number of arguments, with the following meaning:
- a symbol: the name of the session to use; - a symbol: the name of the session to use;
@ -790,7 +796,7 @@ end
@gp :GP1 "plot sin(x)" @gp :GP1 "plot sin(x)"
@gp :GP2 "plot sin(x)" @gp :GP2 "plot sin(x)"
quitall() Gnuplot.quitall()
``` ```
### Further examples ### Further examples
@ -822,9 +828,9 @@ name = "\\\$MyDataSet1"
@gp :- "plot \$name 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 for a, b and c # Retrieve values for a, b and c
a = parse(Float64, exec("print a")) a = Meta.parse(Gnuplot.exec("print a"))
b = parse(Float64, exec("print b")) b = Meta.parse(Gnuplot.exec("print b"))
c = parse(Float64, exec("print c")) c = Meta.parse(Gnuplot.exec("print c"))
# Save to a PDF file # Save to a PDF file
save(term="pdf", output="gnuplot.pdf") save(term="pdf", output="gnuplot.pdf")