GnuplotEx.Session (gnuplot_ex v0.5.1)
Named sessions for managing multiple independent gnuplot processes.
Sessions allow you to maintain separate gnuplot contexts, useful for:
- Running multiple plots in parallel
- Keeping different terminal configurations
- Isolating plot state
Example
# Start a named session
{:ok, _pid} = GnuplotEx.Session.start_link(name: :analysis)
# Plot using the session
GnuplotEx.plot(:analysis, [[:plot, 'sin(x)']])
# List active sessions
GnuplotEx.Session.list()
# => [:analysis]
# Stop session
GnuplotEx.Session.stop(:analysis)Default Session
If you call GnuplotEx.plot/2 without a session name, it uses the
one-shot port approach (no persistent session).
Summary
Functions
Returns a specification to start this module under a supervisor.
Check if a session exists.
Get session info.
List all active session names.
Execute a plot in a named session.
Start a named session.
Stop a named session.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Check if a session exists.
Example
GnuplotEx.Session.exists?(:analysis)
# => true
Get session info.
Example
GnuplotEx.Session.info(:analysis)
# => %{name: :analysis, plot_count: 5, started_at: ~U[...]}
@spec list() :: [atom()]
List all active session names.
Example
GnuplotEx.Session.list()
# => [:analysis, :realtime]
Execute a plot in a named session.
Example
GnuplotEx.Session.plot(:analysis, commands, datasets)
@spec start_link(keyword()) :: GenServer.on_start()
Start a named session.
Options
:name- Session name (required)
Example
{:ok, pid} = GnuplotEx.Session.start_link(name: :my_session)
@spec stop(atom()) :: :ok
Stop a named session.
Example
:ok = GnuplotEx.Session.stop(:analysis)