From f4c459badea01411661d69689341e8bc10109ed7 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sun, 4 Nov 2012 22:58:38 +0100 Subject: add alternative constructors to DataSet --- src/main/scala/scalam/plotting/DataSet.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/scala/scalam/plotting/DataSet.scala b/src/main/scala/scalam/plotting/DataSet.scala index 5125478..381bf00 100644 --- a/src/main/scala/scalam/plotting/DataSet.scala +++ b/src/main/scala/scalam/plotting/DataSet.scala @@ -21,6 +21,10 @@ case class DataSet(points: Seq[(Double, Double)], label: String, name: String) { object DataSet { def apply(points: Seq[(Double, Double)], label: String) = new DataSet(points, label, Identifier.makeValid(label)) + + def apply(xs: Seq[Double], ys: Seq[Double], label: String) = new DataSet(xs zip ys, label, Identifier.makeValid(label)) + + def apply(xs: Seq[Double], ys: Seq[Double], label: String, name: String) = new DataSet(xs zip ys, label, name) implicit def dataSetIsSaveable(ds: DataSet) = new Saveable { def save(out: scalax.file.Path) = for ((x, y) <- ds.points) yield out.write(x + " " + y + "\n") -- cgit v1.2.3