aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/scalam/plotting/DataSet.scala
blob: 07813ef10251c3714ea13f805177d8349991d08a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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")
  }

}