diff options
Diffstat (limited to 'src/main/scala/scalam/plotting/DataSet.scala')
-rw-r--r-- | src/main/scala/scalam/plotting/DataSet.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/scala/scalam/plotting/DataSet.scala b/src/main/scala/scalam/plotting/DataSet.scala new file mode 100644 index 0000000..07813ef --- /dev/null +++ b/src/main/scala/scalam/plotting/DataSet.scala @@ -0,0 +1,17 @@ +package scalam.plotting + +import scalax.file.Path +import breeze.linalg.{ Vector, DenseVector } + +case class DataSet(points: Seq[(Double, Double)], label: String) { + val name = label + + lazy val (xs, ys) = points.unzip + def save(path: Path) = { + path.createFile(createParents = true, failIfExists = false) + for (processor <- path.outputProcessor; out = processor.asOutput) + for ((x, y) <- points) out.write(x + " " + y + "\n") + } + +} + |