Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active February 3, 2026 20:27
Show Gist options
  • Select an option

  • Save dacr/cf2eaffc59c13d4f03b7b0c78cad0203 to your computer and use it in GitHub Desktop.

Select an option

Save dacr/cf2eaffc59c13d4f03b7b0c78cad0203 to your computer and use it in GitHub Desktop.
gaussian simple function drawn using breeze / published by https://github.com/dacr/code-examples-manager #8520e780-bf17-4b51-bc7e-6c5f8f9e4a41/aa4cc0d0e9496c665d48427c6c160871d10a0d51
// summary : gaussian simple function drawn using breeze
// keywords : plotting, breeze, math, gaussian
// publish : gist
// authors : David Crosson
// license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
// id : 8520e780-bf17-4b51-bc7e-6c5f8f9e4a41
// created-on : 2021-02-07T17:36:22Z
// managed-by : https://github.com/dacr/code-examples-manager
// execution : scala ammonite script (http://ammonite.io/) - run as follow 'amm scriptname.sc'
// breeze viz documentation -> https://github.com/scalanlp/breeze/wiki/Quickstart
import $ivy.`org.scalanlp::breeze:1.1`
import $ivy.`org.scalanlp::breeze-viz:1.1`
import breeze.linalg._
import breeze.plot._
import breeze.numerics._
val f = Figure()
val p = f.subplot(0)
val x = linspace(-5, 5, 1000)
p += plot(x, exp ( - (x ^:^ 2.0)) , name = "simple-gaussian") // Take care of operator priority with breeze special operators !
p.xlabel = "x"
p.ylabel = "y"
p.legend = true
scala.io.StdIn.readLine("Press enter to quit")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment