Last active
February 3, 2026 20:22
-
-
Save dacr/df01a9bd85da4d74518273951876eb38 to your computer and use it in GitHub Desktop.
smile scatter vega visualization / published by https://github.com/dacr/code-examples-manager #17c4473f-fde6-43ff-80a0-54913a975c82/912d319c3b2a640abb4cc2db91ae644e16a3f3aa
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 : smile scatter vega visualization | |
| // keywords : smile, chart, visualization, scatter, vega | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : 17c4473f-fde6-43ff-80a0-54913a975c82 | |
| // created-on : 2021-03-05T09:23:01Z | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file | |
| // --------------------- | |
| //> using scala "3.4.2" | |
| //> using dep "com.github.pathikrit::better-files:3.9.2" | |
| //> using dep "com.github.haifengl::smile-scala:3.1.1" | |
| //> using dep "org.slf4j:slf4j-nop:2.0.13" | |
| //> using dep "com.lihaoyi::requests:0.9.0" | |
| // --------------------- | |
| import scala.language.postfixOps | |
| import scala.language.existentials | |
| import better.files.* | |
| import smile.read | |
| import smile.plot.vega.* // FOR VEGA RENDERING | |
| //import smile.plot.* | |
| // examples coming from http://haifengl.github.io/visualization.html | |
| // -------------------------------------------------------------------- | |
| val inputFileName = "iris.arff" | |
| val inputFile = inputFileName.toFile | |
| if (inputFile.notExists) { | |
| val url = "https://gist.githubusercontent.com/myui/143fa9d05bd6e7db0114/raw/500f178316b802f1cade6e3bf8dc814a96e84b1e/iris.arff" | |
| for {out <- inputFile.newOutputStream.autoClosed} {requests.get(url).writeBytesTo(out)} | |
| } | |
| // -------------------------------------------------------------------- | |
| { | |
| val iris = read.arff("iris.arff") | |
| val splom = VegaLite.splom(iris, "class").title("Scatter Plot Matrix") | |
| splom.show(true) | |
| } | |
| // -------------------------------------------------------------------- | |
| println("enter to exit"); scala.io.StdIn.readLine() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment