GnuplotEx.Spec (gnuplot_ex v0.2.0)
Inspectable command specifications for gnuplot.
Specs provide an intermediate representation that can be built, inspected, and then executed. Useful for debugging, testing, and understanding what commands will be sent to gnuplot.
Example
spec = GnuplotEx.Spec.build([
[:set, :terminal, :svg],
[:plot, "-", :with, :lines]
], [data])
# Inspect the spec
IO.inspect(spec)
# => %GnuplotEx.Spec{
# commands: [[:set, :terminal, :svg], ...],
# script: "set terminal svg;\nplot \"-\" with lines",
# datasets: [[...]]
# }
# Execute when ready
{:ok, _} = GnuplotEx.Spec.execute(spec)Dry Mode
Use GnuplotEx.plot/3 with dry: true to get a spec without executing:
{:ok, spec} = GnuplotEx.plot(commands, data, dry: true)
Summary
Functions
Build a spec from commands and datasets.
Execute a spec, sending commands to gnuplot.
Get the formatted data that would be sent to gnuplot.
Format the spec as a readable string for inspection.
Types
Functions
Build a spec from commands and datasets.
The spec contains:
commands- Original command listsscript- Serialized gnuplot scriptdatasets- Original dataset listsformatted_data- Pre-formatted data strings (populated on execute)
Example
spec = GnuplotEx.Spec.build([[:plot, 'sin(x)']], [])
Execute a spec, sending commands to gnuplot.
Example
spec = GnuplotEx.Spec.build(commands, data)
{:ok, script} = GnuplotEx.Spec.execute(spec)
Get the formatted data that would be sent to gnuplot.
Useful for debugging data transmission issues.
Example
spec = GnuplotEx.Spec.build(commands, data)
formatted = GnuplotEx.Spec.format_data(spec)
IO.puts(formatted)
Format the spec as a readable string for inspection.
Example
spec = GnuplotEx.Spec.build(commands, data)
IO.puts(GnuplotEx.Spec.to_string(spec))