Last active
May 25, 2024 10:19
-
-
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/f1218da87b19090b9f6125c2981ab913b6be337f
This file contains hidden or 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
// 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.4.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