diff options
author | Jakob Odersky <jodersky@gmail.com> | 2012-11-06 11:48:38 +0100 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2012-11-06 11:48:38 +0100 |
commit | 3351e36228415c5a36c4efc2d1b2ccd85730fc25 (patch) | |
tree | 28fee4373342f0b7aef212dc9546ea155e036bc4 /src/main/scala/scalam/plotting/Plotter.scala | |
parent | 0c2e7ce8e841d149b18a30fad6a04525a121833b (diff) | |
download | scalam-3351e36228415c5a36c4efc2d1b2ccd85730fc25.tar.gz scalam-3351e36228415c5a36c4efc2d1b2ccd85730fc25.tar.bz2 scalam-3351e36228415c5a36c4efc2d1b2ccd85730fc25.zip |
add self-type to plotter to allow flexible composition
Diffstat (limited to 'src/main/scala/scalam/plotting/Plotter.scala')
-rw-r--r-- | src/main/scala/scalam/plotting/Plotter.scala | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/main/scala/scalam/plotting/Plotter.scala b/src/main/scala/scalam/plotting/Plotter.scala index cdc1ef3..199827c 100644 --- a/src/main/scala/scalam/plotting/Plotter.scala +++ b/src/main/scala/scalam/plotting/Plotter.scala @@ -2,32 +2,20 @@ package scalam.plotting import scalam.m._ import scalam.m.ast._ -import scalam.plotting.styles._ import scalam.m.interpretation.MInterpreter -import scalam.m.interpretation.MatlabInterpreter import scalax.file.Path -trait Plotter { +trait Plotter { self: MInterpreter => import Plotter._ - val pwd: scalax.file.Path - - lazy val interpreter: MInterpreter = new MatlabInterpreter(pwd) - def plot(dataSets: Seq[DataSet], title: String, x: String, y: String, grid: Boolean = true, legend: Boolean = true)(implicit styles: Seq[Style[StyleElement]] = defaultStyles, fontSize: FontSize = defaultFontSize) = { val plot = new Plot(dataSets, title, x, y, grid, legend, styles = styles, fontSize = fontSize.fontSize) val path = Path(Identifier.makeValid(title)) scalam.io.save(plot, path) val s = Function(Identifier("run"), StringLiteral((path / Plot.PlotFileName).path)) - println(s.line) - interpreter.evaluate(s) + self.evaluate(s) } - def exit() { - interpreter.write("exit") - interpreter.close() - } - } object Plotter { |