Created
November 16, 2014 02:56
-
-
Save satoshihirose/49fac5ad48b39c5970ae to your computer and use it in GitHub Desktop.
breeze-viz-example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main { | |
def main(args: Array[String]) = { | |
import breeze.linalg._ | |
import breeze.plot._ | |
import breeze.numerics._ | |
val f = Figure() | |
val p = f.subplot(0) | |
val x = linspace(-10.0,10.0) | |
p += plot(x, sin(x), '.') | |
p += plot(x, cos(x), '.') | |
p.title = "lines plotting" | |
val p2 = f.subplot(2,2,1) | |
val g2 = breeze.stats.distributions.Gaussian(0,1) | |
p2 += hist(g2.sample(100000),100) | |
p2.title = "A normal distribution" | |
val p3 = f.subplot(2,2,2) | |
val g3 = breeze.stats.distributions.Poisson(5) | |
p3 += hist(g3.sample(100000),100) | |
p3.title = "A poisson distribution" | |
val p4 = f.subplot(2,2,3) | |
p4 += image(DenseMatrix.rand(200,200)) | |
p4.title = "A random distribution" | |
f.saveas("image.png") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should explicitly provide breeze-viz as dependency, for example for sbt: add
libraryDependencies += "org.scalanlp" %% "breeze-viz" % "0.13.2"
to build.sbt