Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active April 2, 2023 10:10
Show Gist options
  • Save dacr/cf2eaffc59c13d4f03b7b0c78cad0203 to your computer and use it in GitHub Desktop.
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/6fd08325f27d1b63bc5351d6f253c9ba208f3b52
// summary : gaussian simple function drawn using breeze
// keywords : plotting, breeze, math, gaussian
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// 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