Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active May 8, 2023 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacr/29ac3be9e703bc4dc7855a2d7c1b77c3 to your computer and use it in GitHub Desktop.
Save dacr/29ac3be9e703bc4dc7855a2d7c1b77c3 to your computer and use it in GitHub Desktop.
first example with a new scala plotting library (nspl) / published by https://github.com/dacr/code-examples-manager #f87e3ef9-6483-4510-9d57-ce60ed4bfb3c/668344e6468e0e55cbd95d9828db6e30e158585c
// summary : first example with a new scala plotting library (nspl)
// keywords : plotting, nspl
// publish : gist
// authors : nspl documentation
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : f87e3ef9-6483-4510-9d57-ce60ed4bfb3c
// created-on : 2020-05-31T19:54:52Z
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// ---------------------
//> using scala "3.2.2"
//> using dep "io.github.pityka::nspl-awt:0.10.0"
// ---------------------
// This example coming from this page https://pityka.github.io/nspl/
import org.nspl.*
import awtrenderer.*
val x: Seq[Double] = Seq(1d, 2d, 3d)
val y: Seq[Double] = Seq(6d, 7d, 10d)
val plot = xyplot(x -> y)(par.withMain("Main label")
.withYLab("y")
.withXLab("x")
)
show(plot)
println("After some experimentation, breeze vizualisation looks like a far better alternative")
Thread.sleep(10 * 1000L)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment