Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/optim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuilhem Cheron <guilhem.cheron@inria.fr>2016-05-27 12:07:46 +0300
committerGuilhem Cheron <guilhem.cheron@inria.fr>2016-05-27 12:07:46 +0300
commit7044cd2da3c2ebe797336368f31366dd47f711ce (patch)
tree8e2b911f279db71a0262063197d4ad24ad312657
parentefdc2404a843c9e16535e633df16fceb28c88bd8 (diff)
add logscale support
-rw-r--r--Logger.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/Logger.lua b/Logger.lua
index 91b93e5..02421b9 100644
--- a/Logger.lua
+++ b/Logger.lua
@@ -28,6 +28,11 @@ Example:
logger:style{'-', '-'} -- define styles for plots
logger:plot() -- and plot
+
+-----------
+
+ logger:setlogscale(true) -- enable logscale on Y-axis
+ logger:plot() -- and plot
]]
require 'xlua'
local Logger = torch.class('optim.Logger')
@@ -56,6 +61,7 @@ function Logger:__init(filename, timestamp)
self.showPlot = true
self.plotRawCmd = nil
self.defaultStyle = '+'
+ self.logscale = false
end
function Logger:setNames(names)
@@ -116,6 +122,10 @@ function Logger:style(symbols)
end
end
+function Logger:setlogscale(value)
+ self.logscale = value
+end
+
function Logger:plot(...)
if not xlua.require('gnuplot') then
if not self.warned then
@@ -153,6 +163,7 @@ function Logger:plot(...)
if plotit then
if self.showPlot then
self.figure = gnuplot.figure(self.figure)
+ if self.logscale then gnuplot.logscale('on') end
gnuplot.plot(plots)
if self.plotRawCmd then gnuplot.raw(self.plotRawCmd) end
gnuplot.grid('on')
@@ -161,6 +172,7 @@ function Logger:plot(...)
if self.epsfile then
os.execute('rm -f "' .. self.epsfile .. '"')
local epsfig = gnuplot.epsfigure(self.epsfile)
+ if self.logscale then gnuplot.logscale('on') end
gnuplot.plot(plots)
if self.plotRawCmd then gnuplot.raw(self.plotRawCmd) end
gnuplot.grid('on')