-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIrisBoxPlot.scala
More file actions
32 lines (24 loc) · 907 Bytes
/
IrisBoxPlot.scala
File metadata and controls
32 lines (24 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package examples
import java.io.File
import kantan.csv._
import kantan.csv.ops._
import kantan.csv.generic._
import de.dreambeam.veusz.components.{Boxplot, Graph}
import de.dreambeam.veusz.data.{BoxplotData}
import de.dreambeam.veusz.format.{AxisMode}
object IrisBoxPlot extends App {
// Read CSV
val reader = new File("data/iris/iris.data").asUnsafeCsvReader[IrisRow](rfc.withoutHeader).toVector
val sepalLength = reader map(_.sepalLength)
val sepalWidth = reader map(_.sepalWidth)
val petalLength = reader map(_.petalLength)
val petalWidth = reader map(_.petalWidth)
val boxPlotData = BoxplotData(
data=Vector(sepalLength, sepalWidth, petalLength, petalWidth),
labels=Vector("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")
)
val boxPlot = Boxplot(boxPlotData)
val graph = Graph(boxPlot)
graph.axis(0).mode = AxisMode.Labels
graph.show("IrisBoxPlot")
}