pityka / nspl Goto Github PK
View Code? Open in Web Editor NEWscala plotting (charting, graphing) library
Home Page: https://pityka.github.io/nspl/
License: Other
scala plotting (charting, graphing) library
Home Page: https://pityka.github.io/nspl/
License: Other
I have looked at the examples in the file:
https://github.com/pityka/nspl/blob/master/saddle/src/test/scala/plots/plots.test.scala
But cannot get rendering to a file to work. I have the following code:
import org.nspl.xyplot
import org.nspl.scalatagrenderer
import org.nspl.ColumnLayout
import org.nspl.awtrenderer._
import org.nspl.group
val x : Seq[Double] = Seq(1d,2d,3d)
val y : Seq[Double] = Seq(6d,7d,10d)
val plot = xyplot(x -> y)(
ylab = "y",
xlab = "x",
main = "main"
)
show(plot)
val gallery: Build[_root_.org.nspl.Elems1[_root_.org.nspl.Elems2[_root_.org.nspl.XYPlotArea, _root_.org.nspl.Legend]]] = group(
plot,
ColumnLayout(3)
)
show(gallery)
import org.nspl.awtrenderer.renderToFile
renderToFile(gallery, 1000, "image/svg")
renderToFile(plot, 1000, "image/svg")
The show call. The last two calls fail with:
[error] UFSpec.scala:1893: inferred type arguments [org.nspl.Build[org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.Legend]]]] do not conform to method renderToFile's type parameter bounds [K <: org.nspl.Renderable[K]]
[error] renderToFile(gallery, 1000, "image/svg")
[error] ^
[error] UFSpec.scala:1893: type mismatch;
[error] found : org.nspl.Build[org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.Legend]]]
[error] (which expands to) ((Option[org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.ElemList[org.nspl.Elems2[org.nspl.ShapeElem,org.nspl.TextBox]]]]], org.nspl.Event)) => org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.ElemList[org.nspl.Elems2[org.nspl.ShapeElem,org.nspl.TextBox]]]]
[error] required: K
[error] renderToFile(gallery, 1000, "image/svg")
[error] ^
[error] UFSpec.scala:1896: inferred type arguments [org.nspl.Build[org.nspl.Elems1[org.nspl.Elems2[org.nspl.XYPlotArea,org.nspl.Legend]]]] do not conform to method pngToFile's type parameter bounds [K <: org.nspl.Renderable[K]]
[error] pngToFile(gallery)
[error] ^
Here is my SBT build file
lazy val root = (project in file(".")).
settings(
inThisBuild(List(
organization := "com.example",
scalaVersion := "2.12.4",
version := "0.1.0-SNAPSHOT"
)),
name := "UFD",
libraryDependencies ++= Seq(
"com.github.pathikrit" %% "better-files" % "3.2.0",
"io.github.pityka" %% "nspl-awt" % "0.0.19",
"io.github.pityka" %% "nspl-scalatags-jvm" % "0.0.19",
"org.scalatest" %% "scalatest" % "3.0.4" % "test")
)
Can anyone tell me what I am doing wrong?
BTW, is their a support forum or mailing list for nspl?
TIA
Hey,
Any reason trait SimplePlots
's class Parameters()
is not a simple case class Params()
?
It seems you would benefit from the case class copy function, and Parameters does not need to be called by reference (at least I couldn't find where it would).
Not really an issue, just curious of this factory pattern.
Thanks in advance for your answer.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.