diff options
author | koray kavukcuoglu <koray@kavukcuoglu.org> | 2015-07-30 20:28:37 +0300 |
---|---|---|
committer | koray kavukcuoglu <koray@kavukcuoglu.org> | 2015-07-30 20:28:37 +0300 |
commit | e5da24d3b011eb8ee6a8f003a6d844f75947ec36 (patch) | |
tree | 221171312fa86a8465bc0766ecd94199b7b3becf | |
parent | 5035f46f7337a3eb1624d29ac6b3f1c717abb5fc (diff) | |
parent | af47854f2127744d4a8b83b2c0d601f63bea468c (diff) |
Merge pull request #62 from mys007/loggerex
New features in Logger
-rw-r--r-- | Logger.lua | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -53,6 +53,9 @@ function Logger:__init(filename, timestamp) self.names = {} self.idx = {} self.figure = nil + self.showPlot = true + self.plotRawCmd = nil + self.defaultStyle = '+' end function Logger:setNames(names) @@ -62,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') @@ -77,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 @@ -148,14 +151,18 @@ function Logger:plot(...) end end if plotit then - self.figure = gnuplot.figure(self.figure) - gnuplot.plot(plots) - gnuplot.grid('on') - gnuplot.title('<Logger::' .. self.name .. '>') + 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 if self.epsfile then 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() |