From 13efbb4af83d366c092635e1da103eb0a4730f54 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 21 Apr 2024 14:52:52 +0300 Subject: Stream:gnuplot() now takes an optional terminal parameter * This is especially useful when plotting to GNU pic scripts by setting terminal to "gpic". But also for all formats that are not guessed from the file extension. --- applause.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'applause.lua') diff --git a/applause.lua b/applause.lua index bfc5979..074afca 100644 --- a/applause.lua +++ b/applause.lua @@ -883,11 +883,13 @@ end -- Graphics will be displayed inline in Jupyter notebooks and when -- using the [kitty](https://sw.kovidgoyal.net/kitty/) terminal emulator. -- @string[opt] file --- If specified, render to the file name instead of into a window. --- The file type is guessed from the file extension. +-- If specified, render to the file name instead of into a window or GUI. +-- The terminal type is guessed from the file extension. +-- @string[opt] terminal +-- If file is given, this specifies the terminal type (file type). -- @warning This requires the feedgnuplot script. -- @fixme gnuplot is not the ideal tool for plotting audio data. -function Stream:gnuplot(file) +function Stream:gnuplot(file, terminal) if self:len() == math.huge then error("Cannot plot infinite stream") end @@ -898,6 +900,7 @@ function Stream:gnuplot(file) if file then assert(not file:find("'")) cmd = cmd.." --hardcopy '"..file.."'" + if terminal then cmd = cmd.." --terminal '"..terminal.."'" end elseif _G._send_display_data then -- Some extremely crude support for plotting directly into Jupyter ILua cells. -- NOTE: With io.popen() we cannot read and write to the pipe at the -- cgit v1.2.3