diff options
author | Martin Simonovsky <simonovm@imagine.enpc.fr> | 2015-07-30 19:54:06 +0300 |
---|---|---|
committer | Martin Simonovsky <simonovm@imagine.enpc.fr> | 2015-07-30 19:54:06 +0300 |
commit | af47854f2127744d4a8b83b2c0d601f63bea468c (patch) | |
tree | 7dd0045427b8da617e1204f36fe35823fad4c263 | |
parent | f3316cf14fd46378795dde93b6ae1bfa4aa8e3d1 (diff) |
- added possibility to set the default symbol and to pass raw commands to gnuplot
-rw-r--r-- | Logger.lua | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -54,6 +54,8 @@ function Logger:__init(filename, timestamp) self.idx = {} self.figure = nil self.showPlot = true + self.plotRawCmd = nil + self.defaultStyle = '+' end function Logger:setNames(names) @@ -63,7 +65,7 @@ function Logger:setNames(names) for k,key in pairs(names) do self.file:write(key .. '\t') self.symbols[k] = {} - self.styles[k] = {'+'} + self.styles[k] = {self.defaultStyle} self.idx[key] = k end self.file:write('\n') @@ -78,7 +80,7 @@ function Logger:add(symbols) for k,val in pairs(symbols) do self.file:write(k .. '\t') self.symbols[k] = {} - self.styles[k] = {'+'} + self.styles[k] = {self.defaultStyle} self.names[k] = k end self.idx = self.names @@ -152,6 +154,7 @@ function Logger:plot(...) if self.showPlot then self.figure = gnuplot.figure(self.figure) gnuplot.plot(plots) + if self.plotRawCmd then gnuplot.raw(self.plotRawCmd) end gnuplot.grid('on') gnuplot.title('<Logger::' .. self.name .. '>') end @@ -159,6 +162,7 @@ function Logger:plot(...) os.execute('rm -f "' .. self.epsfile .. '"') local epsfig = gnuplot.epsfigure(self.epsfile) gnuplot.plot(plots) + if self.plotRawCmd then gnuplot.raw(self.plotRawCmd) end gnuplot.grid('on') gnuplot.title('<Logger::' .. self.name .. '>') gnuplot.plotflush() |